![]() |
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
|
Manages communication with checkpoint service hosted with supernode. ConnectionManager is main object you use with API. All client operations are initiated using methods in this class with exception of virtual index manager which is sub object of ConnectionManager (ConnnectionManager.VNIndexManager()). More...
#include <ConnectionManager.h>
Public Types | |
enum | ConnectionManagerStatus { CMS_NONE = 0, CMS_CONNECTING = 1, CMS_CONNECTED = 2, CMS_DOWN = 3 } |
Status of PeerManager More... | |
enum | SessionFailReason { SFR_NONE = 0, SFR_TIMEOUT_EXPIRED = 1, SFR_AUTHENTFICATION_FAILURE = 2, SFR_SERVER_UNREACHABLE = 3, SFR_CLIENT_ERROR = 4, SFR_API_VERSION_UNSUPPORTED = 5 } |
Reason for not opening session with checkpoint server More... | |
enum | PeerConnectFailureReason { PCFR_NONE = 0, PCFR_UNKNOWN = 1, PCFR_PEER_NOT_FOUND = 2, PCFR_TIMEOUT_EXPIRED = 3, PCFR_REFUSED_BY_PEER = 4, PCFR_HANDSHAKE_UNSUCCESSFUL = 5, PCFR_OPERATION_FORBIDEN_ON_NETWORK = 6 } |
Reason for not initiating connection to peer More... | |
typedef Delegate < ConnectionManager *, Peer *, ConnectionType, bool * > * | AcceptPeerConnection |
Function pointer for function deciding of peer acceptance. By default only .BlockIncoming parameter is considered | |
typedef Delegate < ConnectionManager *, ConnectionManagerStatus > * | StatusChange |
Status change delegate | |
typedef Delegate < ConnectionManager * > * | SessionOpenSuccess |
Session open with success function pointer | |
typedef Delegate < ConnectionManager *, SessionFailReason > * | SessionOpenFailure |
Session open failure function pointer | |
typedef Delegate < ConnectionManager *, bool, SessionFailReason > * | SessionOpenCallback |
Session open callback function pointer | |
typedef Delegate < ConnectionManager * > * | SessionDrop |
Session drop callback function pointer | |
typedef Delegate< Peer *, Guid * > * | PeerConnect |
Function pointer for function to trigger when connection to peer (if connect) is successfully created | |
typedef Delegate< Peer *, Guid * > * | PeerAccept |
Function pointer for function to trigger when connection to peer (if accept) is successfully created | |
typedef Delegate< Peer *, int, bool, Guid *, int, int, int > * | PeerQueryCompleted |
Function pointer to function to be called on results arrival after peer query request | |
typedef Delegate< Peer *, sp2plib::UInt32 > * | PeerStateChanged |
Function pointer to function to be called to be called when information about peer state change arrives | |
typedef Delegate< Peer *, Guid *, Guid *, Guid *, bool, PeerConnectFailureReason > * | PeerConnectCallback |
Function pointer to pass as argument to ConnectionManager.Connect to be executed on connecton creation | |
typedef Delegate< Guid *, Guid *, Guid *, int, unsigned char *, int > * | ReceiveInstantMessage |
Function pointer to function to be called when instant message is Received | |
typedef Delegate< Guid *, Guid *, Guid *, PeerConnectFailureReason > * | PeerConnectFailure |
Function pointer for function to be called when connection attempt fails | |
typedef Delegate< Guid *, bool > * | SendInstantMessageComplete |
Function pointer for function to be called when instant message is sent to checkpoint server | |
typedef Delegate< Guid * > * | StateTrackActionFailed |
Function pointer for function to be called when state track action (register/un-register tracking) fails | |
typedef Delegate < ConnectionManager *, IP4Address * > * | NetworkInterfaceChange |
Function pointer for function to be called when ConnectionManager dispatcher network interface changes | |
Public Member Functions | |
ConnectionManager (IPEndPoint SupernodeEP, IPEndPoint LocalBindPoint) | |
Initializes new instance of ConnectionManager class | |
ConnectionManager (IPEndPoint SupernodeEP) | |
Initializes new instance of ConnectionManager class | |
virtual ::std::string | ObjectClassName () |
void | SetAcceptPeerConnectionResolver (AcceptPeerConnection Delegate) |
Sets function pointer of type sp2plib::ConnectionManager::AcceptPeerConnection to function that desides will remote peer be alowed to connect or not . By default only sp2plib::ConnectionManager.BlockIncoming parameter is considered | |
void | Open (SessionOpenCallback Callback=NULL) |
Opens session with checkpoint server | |
void | Close () |
Closes session with checkpoint server | |
Guid | Query (Guid PeerUID, PeerQueryCompleted Callback=NULL) |
Queries remote peer by its UID | |
Guid | Query (::std::string QueryText, PeerQueryCompleted Callback=NULL, int page=0, int pageLimit=64) |
Queries remote peers by their application specific parameters | |
Guid | RegisterStateTracking (Guid &PeerUID) |
Register for receiving informations about peer state changes | |
Guid | UnregisterStateTracking (Guid &PeerUID) |
Unregister for receiving informations about peer state changes | |
Guid | RegisterStateTracking (::std::list< Guid > *PeerUIDList) |
Register for receiving informations about peers state changes | |
Guid | UnregisterStateTracking (::std::list< Guid > *PeerUIDList) |
Unregister for receiving informations about peers state changes | |
Guid | SendInstantMessage (Guid RemotePeerCheckpointUID, Guid RemotePeerUID, unsigned char *message_buffer, int message_len, int InstantMessageType=0, SendInstantMessageComplete Callback=NULL) |
Sends instant message to remote peer using checkpoint server system | |
Guid | SendInstantMessage (Guid RemotePeerCheckpointUID, Guid RemotePeerUID,::std::string Message, int InstantMessageType=0, SendInstantMessageComplete Callback=NULL) |
Sends instant message to remote peer using checkpoint server system | |
Guid | SendInstantMessage (Peer &Peer, unsigned char *message_buffer, int message_len, int InstantMessageType=0, SendInstantMessageComplete Callback=NULL) |
Sends instant message to remote peer using checkpoint server system | |
Guid | SendInstantMessage (Peer &Peer,::std::string Message, int InstantMessageType=0, SendInstantMessageComplete Callback=NULL) |
Sends instant message to remote peer using checkpoint server system | |
Guid | BrodcastStateChange () |
Sends information of local peer state change to checkpoint and all other peers registered to track local peer state | |
Guid | Connect (Peer &Peer, ConnectionType ConnectionType, IPEndPoint BindEndPoint=IPEndPoint::ANY(), PeerConnectCallback callback=NULL) |
Connects to peer using information given in a peer object | |
Guid | Connect (Peer &Peer, ConnectionType ConnectionType, Guid UserTransactionUID, IPEndPoint BindEndPoint=IPEndPoint::ANY(), PeerConnectCallback callback=NULL) |
Connects to peer using information given in a peer object | |
Guid | Connect (Guid CheckPointUID, Guid PeerUID, ConnectionType ConnectionType, IPEndPoint BindEndPoint=IPEndPoint::ANY(), PeerConnectCallback callback=NULL) |
Connect to peer using identifiers of peer itself and it's checkpoint | |
Guid | Connect (Guid CheckPointUID, Guid PeerUID, ConnectionType ConnectionType, Guid UserTransactionUID, IPEndPoint BindEndPoint=IPEndPoint::ANY(), PeerConnectCallback callback=NULL) |
Connect to peer using identifiers of peer itself and it's checkpoint | |
ConnectionManagerStatus | GetStatus () |
Gets status (sp2plib::ConnectionManager::ConnectionManagerStatus) of ConnectionManager | |
void | join_primary_thread () |
Stops current thread execution as long as ConnectionManager object is not disposed (deleted) | |
void | Delay (Delegate<> *FunctionDelegate, int milisec) |
Executes delegate function with delay | |
void | Dispose () |
Use this method when you want to delete ConnectionManager object, you don't need to call delete *ConnectionManager; after | |
VNManager * | VNIndexManager () |
Gets virtual index storage manager object used for virtual users/networks object manipulation | |
void | setAccessTokens (Guid providerUID, Guid applicationUID,::std::string accessKey) |
Sets access parameters to needed to get into sP2P stsyem | |
bool | ___crssthread_is_disposed () |
![]() | |
virtual ::std::string | ObjectClassName () |
void | WriteLogEntry (::std::string Text) |
Static Public Member Functions | |
::std::string | ConnectionManagerStatusName (ConnectionManagerStatus Status) |
Converts ConnectionManagerStatus variable to value name string | |
::std::string | SessionFailReasonName (SessionFailReason Reason) |
Converts SessionFailReason variable to value name string | |
::std::string | PeerConnectFailureReasonName (PeerConnectFailureReason Reason) |
Converts PeerConnectFailureReason variable to value name string | |
Public Attributes | |
Event< ConnectionManager *, ConnectionManagerStatus > | onStatusChange |
Raised each time servers status changes | |
Event< ConnectionManager * > | onSessionOpenSuccess |
Raised when session with Check Point server session becomes active | |
Event< ConnectionManager *, SessionFailReason > | onSessionOpenFailure |
Raised when session with Check Point server session fails to open | |
Event< ConnectionManager * > | onSessionDrop |
Raised on session drop | |
Event< Peer *, Guid * > | onPeerConnected |
Raised when connection requested by local peer to remote peer is successfully created | |
Event< Peer *, int, bool, Guid *, int, int, int > | onPeerQueryResponse |
Raised when peer query response arrives | |
Event< Peer *, sp2plib::UInt32 > | onPeerStateChanged |
Raised when information about peer state change arrives (RegisterStateTracking function must be peformed to be able to receve this information) | |
Event< Guid *, Guid *, Guid *, int, unsigned char *, int > | onReceiveInstantMessage |
Raised when instant message arrives. (DO NOT USE unsigned char* POINTER VARIABLE OUSIDE HANDLER FUNCTION SCOPE, BECUSE HEAP WILL BE DE-ALLOCATED (delete[]) WHEN SCOPE IS EXITED, THIS ALSO MEANS THAT YOU DONT HAVE TO CALL delete[] Data; YOURSELF! IF YOU NEED THIS RAW BYTE DATA FOR LATER USE COPY IT TO OTHER BUFFER) | |
Event< Peer *, Guid * > | onPeerAccepted |
Raised when connection requested by remote peer to local peer is successfully created | |
Event< Guid *, Guid *, Guid *, PeerConnectFailureReason > | onPeerAcceptFailure |
Raised when tunnel creation requested from remote peer fails | |
Event< Guid *, Guid *, Guid *, PeerConnectFailureReason > | onPeerConnectFailure |
Raised when tunnel creation requested to remote peer fails | |
Event< Guid *, bool > | onSendInstantMessageComplete |
Raised when instant message is sent to checkpoint server | |
Event< Guid * > | onStateTrackActionFailed |
Raised when state track action (register/un-register tracking) fails | |
Event< ConnectionManager *, IP4Address * > | onNetworkInterfaceChange |
Raised when ConnectionManager dispatcher network interface changes | |
PeerConnectCallback | PeerAccepted |
Get of sets function pointer of type sp2plib::ConnectionManager::PeerConnect to call on peer acceptance as callback function | |
::std::queue< int > | AcceptPortQueue |
If some specific local ports for socket that will be used for accepting connection to remote peer is desired, this queue can be filled with user definded values which will be dequed in that same order | |
Peer | LocalPeer |
Local client peer object | |
int | CheckPointTimeout |
Gets or sets max. time in milliseconds to wait response form checkpoint server. Default value is 12000 (12 seconds). | |
bool | BlockIncoming |
If set to true other peers will not be able to connect | |
bool | MaintainSession |
Gets or sets a value indicating that session establishment with checkpoint should be retried in case of session drop or initial session open failure due TIMEOUT until ConnectionManager.close() method is called. [Default: True] | |
class SP2P_API | HandshakeClient |
Manages communication with checkpoint service hosted with supernode. ConnectionManager is main object you use with API. All client operations are initiated using methods in this class with exception of virtual index manager which is sub object of ConnectionManager (ConnnectionManager.VNIndexManager()).
typedef Delegate<ConnectionManager*,Peer*, ConnectionType,bool*>* sp2plib::ConnectionManager::AcceptPeerConnection |
Function pointer for function deciding of peer acceptance. By default only .BlockIncoming parameter is considered
ConnectionManager | Connection manager |
Peer | Peer requesting connection |
ConnectionType | Requested connection protocol type |
Allow | Output parameter as result of operation: true - alow connection , false - disallow connection |
typedef Delegate<ConnectionManager*, IP4Address*>* sp2plib::ConnectionManager::NetworkInterfaceChange |
Function pointer for function to be called when ConnectionManager dispatcher network interface changes
ConnectionManager | ConnectionManager that raised event |
IP4Address | New address dispatcher is bound to |
typedef Delegate<Peer*, Guid*>* sp2plib::ConnectionManager::PeerAccept |
Function pointer for function to trigger when connection to peer (if accept) is successfully created
Peer | Accepted peer |
TransactionUID | Unique identifier on connect operation |
typedef Delegate<Peer*, Guid*>* sp2plib::ConnectionManager::PeerConnect |
Function pointer for function to trigger when connection to peer (if connect) is successfully created
Peer | Connected peer |
TransactionUID | Unique identifier on connect operation |
typedef Delegate<Peer*, Guid*, Guid*, Guid*, bool, PeerConnectFailureReason>* sp2plib::ConnectionManager::PeerConnectCallback |
Function pointer to pass as argument to ConnectionManager.Connect to be executed on connecton creation
Peer | Peer object (remote peer) if success = true , otherwise null |
PeerCheckpointUID | Unique identifier of remote peer's checkpoint |
PeerUID | Unique identifier of remote peer |
TransactionUID | Unique operation of connect operation |
Success | Outcome of connect operation |
FailReason | If success = false , then reason for failing |
typedef Delegate<Guid*, Guid* , Guid*, PeerConnectFailureReason>* sp2plib::ConnectionManager::PeerConnectFailure |
Function pointer for function to be called when connection attempt fails
PeerCheckpointUID | Checkpoint UID of peer to whom connection creation was attempted |
PeerUID | UID of peer to whom connection creation was attempted |
TransactionUID | Transaction UID |
Reason | Reason of failure |
typedef Delegate<Peer*,int, bool, Guid*, int, int, int>* sp2plib::ConnectionManager::PeerQueryCompleted |
Function pointer to function to be called on results arrival after peer query request
FoundPeers | List of peers returned by query |
Count | Number of peers returned by query |
Completed | If completed then true, not that sometimes result will contain peers but this value will be false. This can happen for example if 10000000 peers are found by serch creterium , and operation timeout expires before all results are collected |
QueryTransactionID | Transaction ID of query request |
Page | Page returned if pagination exists |
PageLimit | Number of peers per page if pagination exists |
TotalPeers | Total number of peers matched by query |
typedef Delegate<Peer*, sp2plib::UInt32>* sp2plib::ConnectionManager::PeerStateChanged |
typedef Delegate<Guid*, Guid*, Guid*, int, unsigned char *,int>* sp2plib::ConnectionManager::ReceiveInstantMessage |
Function pointer to function to be called when instant message is Received
FromPeer | UID (Unique identifier) of remote peer that has sent instant message |
FromPeerCheckpoint | UID (Unique identifier) of remote peer' checkpoint server that has sent instant message |
MessageGUID | Unique identifier of message |
MessageType | Integer value that can be used to distinguish instant messages by several different types if needed in application |
Data | Received bytes (DO NOT USE POINTER VARIABLE OUSIDE HANDLER FUNCTION SCOPE, BECUSE HEAP WILL BE DE-ALLOCATED (delete[]) WHEN SCOPE IS EXITED, THIS ALSO MEANS THAT YOU DONT HAVE TO CALL delete[] Data; YOURSELF! IF YOU NEED THIS RAW BYTE DATA FOR LATER USE COPY IT TO OTHER BUFFER) |
DataSize | Size of Data array |
typedef Delegate<Guid*, bool>* sp2plib::ConnectionManager::SendInstantMessageComplete |
Function pointer for function to be called when instant message is sent to checkpoint server
MessageGUID | UID of instant message |
success | true if sending was successful, otherwise false |
Session drop callback function pointer
ConnectionManager | Connection manager witch session droped |
typedef Delegate<ConnectionManager *, bool, SessionFailReason>* sp2plib::ConnectionManager::SessionOpenCallback |
Session open callback function pointer
ConnectionManager | Callback to use wiht ConnetionManager.Open function to be execute on operation completion |
Success | Outcome of session opening proccess |
Reason | If Success false , gives reason for that outcome |
typedef Delegate<ConnectionManager *, SessionFailReason>* sp2plib::ConnectionManager::SessionOpenFailure |
Session open failure function pointer
ConnectionManager | ConnectionManager that tried opening session |
Reason | Reason |
Session open with success function pointer
ConnectionManager | ConnectionManager that opened session |
Function pointer for function to be called when state track action (register/un-register tracking) fails
TransactionUID | UID of transaction |
typedef Delegate<ConnectionManager *, ConnectionManagerStatus>* sp2plib::ConnectionManager::StatusChange |
Status change delegate
sender | Sending service |
Status | Current status |
Status of PeerManager
Reason for not initiating connection to peer
Reason for not opening session with checkpoint server
sp2plib::ConnectionManager::ConnectionManager | ( | IPEndPoint | SupernodeEP, |
IPEndPoint | LocalBindPoint | ||
) |
Initializes new instance of ConnectionManager class
SupernodeEP | IP End Point of supernode ConnectionManager will connect to |
LocalBindPoint | Local end point to bind internal connection manager socket to (not recomended if you are not sure what you are doing!) |
sp2plib::ConnectionManager::ConnectionManager | ( | IPEndPoint | SupernodeEP | ) |
Initializes new instance of ConnectionManager class
SupernodeEP | IP End Point of supernode ConnectionManager will connect to |
Guid sp2plib::ConnectionManager::BrodcastStateChange | ( | ) |
Sends information of local peer state change to checkpoint and all other peers registered to track local peer state
void sp2plib::ConnectionManager::Close | ( | ) |
Closes session with checkpoint server
Guid sp2plib::ConnectionManager::Connect | ( | Peer & | Peer, |
ConnectionType | ConnectionType, | ||
IPEndPoint | BindEndPoint = IPEndPoint::ANY() , |
||
PeerConnectCallback | callback = NULL |
||
) |
Connects to peer using information given in a peer object
Peer | Peer object containing information of peer to whom we connect |
ConnectionType | Protocol (TCP/UDP) to be used for connection |
BindEndPoint | Local end-point to bind result socket to |
callback | Function delegate of type PeerConnectDelagate to execute on connection completion |
Guid sp2plib::ConnectionManager::Connect | ( | Peer & | Peer, |
ConnectionType | ConnectionType, | ||
Guid | UserTransactionUID, | ||
IPEndPoint | BindEndPoint = IPEndPoint::ANY() , |
||
PeerConnectCallback | callback = NULL |
||
) |
Connects to peer using information given in a peer object
Peer | Peer object containing information of peer to whom we connect |
ConnectionType | Protocol (TCP/UDP) to be used for connection |
UserTransactionUID | User defined transaction UID - useful when peers have need to open multiple tunnels. They can negotiate UID before connect operation, and connection accepter can distungish tunnel connection |
BindEndPoint | Local end-point to bind result socket to |
callback | Function delegate of type PeerConnectDelagate to execute on connection completion |
Guid sp2plib::ConnectionManager::Connect | ( | Guid | CheckPointUID, |
Guid | PeerUID, | ||
ConnectionType | ConnectionType, | ||
IPEndPoint | BindEndPoint = IPEndPoint::ANY() , |
||
PeerConnectCallback | callback = NULL |
||
) |
Connect to peer using identifiers of peer itself and it's checkpoint
CheckPointUID | Peer's CheckPoint Unique Identifier |
PeerUID | Peer's Unique Identifier |
ConnectionType | Protocol (TCP/UDP) to be used for connection |
BindEndPoint | Local end-point to bind result socket to |
callback | Function delegate of type PeerConnectDelagate to execute on connection completion |
Guid sp2plib::ConnectionManager::Connect | ( | Guid | CheckPointUID, |
Guid | PeerUID, | ||
ConnectionType | ConnectionType, | ||
Guid | UserTransactionUID, | ||
IPEndPoint | BindEndPoint = IPEndPoint::ANY() , |
||
PeerConnectCallback | callback = NULL |
||
) |
Connect to peer using identifiers of peer itself and it's checkpoint
CheckPointUID | Peer's CheckPoint Unique Identifier |
PeerUID | Peer's Unique Identifier |
ConnectionType | Protocol (TCP/UDP) to be used for connection |
UserTransactionUID | User defined transaction UID - useful when peers have need to open multiple tunnels. They can negotiate UID before connect operation, and connection accepter can distungish tunnel connection |
BindEndPoint | Local end-point to bind result socket to |
callback | Function delegate of type PeerConnectDelagate to execute on connection completion |
|
static |
Converts ConnectionManagerStatus variable to value name string
void sp2plib::ConnectionManager::Delay | ( | Delegate<> * | FunctionDelegate, |
int | milisec | ||
) |
Executes delegate function with delay
FunctionDelegate | No argument sp2plib delegate for function to be executed |
milisec | Number of milliseconds to delay execution |
void sp2plib::ConnectionManager::Dispose | ( | ) |
Use this method when you want to delete ConnectionManager object, you don't need to call delete *ConnectionManager; after
ConnectionManagerStatus sp2plib::ConnectionManager::GetStatus | ( | ) |
Gets status (sp2plib::ConnectionManager::ConnectionManagerStatus) of ConnectionManager
void sp2plib::ConnectionManager::join_primary_thread | ( | ) |
Stops current thread execution as long as ConnectionManager object is not disposed (deleted)
void sp2plib::ConnectionManager::Open | ( | SessionOpenCallback | Callback = NULL | ) |
Opens session with checkpoint server
Callback | Callback to execute on session open procedure completion |
|
static |
Converts PeerConnectFailureReason variable to value name string
Guid sp2plib::ConnectionManager::Query | ( | Guid | PeerUID, |
PeerQueryCompleted | Callback = NULL |
||
) |
Queries remote peer by its UID
PeerUID | UID of remote peer |
Callback | Callback to execute on result arrival |
Guid sp2plib::ConnectionManager::Query | ( | ::std::string | QueryText, |
PeerQueryCompleted | Callback = NULL , |
||
int | page = 0 , |
||
int | pageLimit = 64 |
||
) |
Queries remote peers by their application specific parameters
QueryText | NoSQL query command text |
Callback | Callback to execute on result arrival |
page | Pagination page |
pageLimit | Maximal number of peers to return per pagination page(request), default is 64, miximum 256 |
Register for receiving informations about peer state changes
Peer | UID of peer to track |
Register for receiving informations about peers state changes
PeerUIDList | List of peers UIDs to track |
Guid sp2plib::ConnectionManager::SendInstantMessage | ( | Guid | RemotePeerCheckpointUID, |
Guid | RemotePeerUID, | ||
unsigned char * | message_buffer, | ||
int | message_len, | ||
int | InstantMessageType = 0 , |
||
SendInstantMessageComplete | Callback = NULL |
||
) |
Sends instant message to remote peer using checkpoint server system
RemotePeerCheckpointUID | Checkpoint UID of remote peer |
RemotePeerUID | UID of remote peer |
message_buffer | Buffer containing message |
message_len | Size of message byte array serialization, MAX : 85196800 |
InstantMessageType | Field that can be used freely in application to distinguish instant messages types, like chat text, control message ... |
Callback | Callback to execute upon message sending completion, note that this is completion of sending message to checkpoint not other peer |
Guid sp2plib::ConnectionManager::SendInstantMessage | ( | Guid | RemotePeerCheckpointUID, |
Guid | RemotePeerUID, | ||
::std::string | Message, | ||
int | InstantMessageType = 0 , |
||
SendInstantMessageComplete | Callback = NULL |
||
) |
Sends instant message to remote peer using checkpoint server system
RemotePeerCheckpointUID | Checkpoint UID of remote peer |
RemotePeerUID | UID of remote peer |
Message | Message text |
InstantMessageType | Field that can be used freely in application to distinguish instant messages types, like chat text, control message ... |
Callback | Callback to execute upon message sending completion, note that this is completion of sending message to checkpoint not other peer |
Guid sp2plib::ConnectionManager::SendInstantMessage | ( | Peer & | Peer, |
unsigned char * | message_buffer, | ||
int | message_len, | ||
int | InstantMessageType = 0 , |
||
SendInstantMessageComplete | Callback = NULL |
||
) |
Sends instant message to remote peer using checkpoint server system
Peer | Remote peer to send message to |
message_buffer | Buffer containing message |
message_len | Size of message byte array serialization, MAX : 85196800 |
InstantMessageType | Field that can be used freely in application to distinguish instant messages types, like chat text, control message ... |
Callback | Callback to execute upon message sending completion, note that this is completion of sending message to checkpoint not other peer |
Guid sp2plib::ConnectionManager::SendInstantMessage | ( | Peer & | Peer, |
::std::string | Message, | ||
int | InstantMessageType = 0 , |
||
SendInstantMessageComplete | Callback = NULL |
||
) |
Sends instant message to remote peer using checkpoint server system
Peer | Remote peer to send message to |
Message | Message text |
InstantMessageType | Field that can be used freely in application to distinguish instant messages types, like chat text, control message ... |
Callback | Callback to execute upon message sending completion, note that this is completion of sending message to checkpoint not other peer |
|
static |
Converts SessionFailReason variable to value name string
void sp2plib::ConnectionManager::SetAcceptPeerConnectionResolver | ( | AcceptPeerConnection | Delegate | ) |
Sets function pointer of type sp2plib::ConnectionManager::AcceptPeerConnection to function that desides will remote peer be alowed to connect or not . By default only sp2plib::ConnectionManager.BlockIncoming parameter is considered
void sp2plib::ConnectionManager::setAccessTokens | ( | Guid | providerUID, |
Guid | applicationUID, | ||
::std::string | accessKey | ||
) |
Sets access parameters to needed to get into sP2P stsyem
ProviderUID | Provider Token To Identify Application Provider |
ApplicationUID | Application Token To Identify Application |
AccessKey | Access Key |
Unregister for receiving informations about peer state changes
Peer | UID of peer to stop tracking |
Unregister for receiving informations about peers state changes
PeerUIDList | List of peers UIDs to stop tracking |
VNManager* sp2plib::ConnectionManager::VNIndexManager | ( | ) |
Gets virtual index storage manager object used for virtual users/networks object manipulation
It's recommended that you always use ConnectionManager.IndexManager property to access this object, because for example in case of silent redirect this object may change
::std::queue<int> sp2plib::ConnectionManager::AcceptPortQueue |
If some specific local ports for socket that will be used for accepting connection to remote peer is desired, this queue can be filled with user definded values which will be dequed in that same order
bool sp2plib::ConnectionManager::BlockIncoming |
If set to true other peers will not be able to connect
int sp2plib::ConnectionManager::CheckPointTimeout |
Gets or sets max. time in milliseconds to wait response form checkpoint server. Default value is 12000 (12 seconds).
Peer sp2plib::ConnectionManager::LocalPeer |
Local client peer object
bool sp2plib::ConnectionManager::MaintainSession |
Gets or sets a value indicating that session establishment with checkpoint should be retried in case of session drop or initial session open failure due TIMEOUT until ConnectionManager.close() method is called. [Default: True]
true if session should be maintained, false if not.
Event<ConnectionManager*, IP4Address*> sp2plib::ConnectionManager::onNetworkInterfaceChange |
Raised when ConnectionManager dispatcher network interface changes
Raised when connection requested by remote peer to local peer is successfully created
Event<Guid*, Guid*, Guid*, PeerConnectFailureReason> sp2plib::ConnectionManager::onPeerAcceptFailure |
Raised when tunnel creation requested from remote peer fails
Raised when connection requested by local peer to remote peer is successfully created
Event<Guid*, Guid*, Guid*, PeerConnectFailureReason> sp2plib::ConnectionManager::onPeerConnectFailure |
Raised when tunnel creation requested to remote peer fails
Raised when peer query response arrives
Raised when information about peer state change arrives (RegisterStateTracking function must be peformed to be able to receve this information)
Event<Guid*, Guid*, Guid*, int, unsigned char*,int> sp2plib::ConnectionManager::onReceiveInstantMessage |
Raised when instant message arrives. (DO NOT USE unsigned char* POINTER VARIABLE OUSIDE HANDLER FUNCTION SCOPE, BECUSE HEAP WILL BE DE-ALLOCATED (delete[]) WHEN SCOPE IS EXITED, THIS ALSO MEANS THAT YOU DONT HAVE TO CALL delete[] Data; YOURSELF! IF YOU NEED THIS RAW BYTE DATA FOR LATER USE COPY IT TO OTHER BUFFER)
Raised when instant message is sent to checkpoint server
Event<ConnectionManager *> sp2plib::ConnectionManager::onSessionDrop |
Raised on session drop
Event<ConnectionManager *, SessionFailReason> sp2plib::ConnectionManager::onSessionOpenFailure |
Raised when session with Check Point server session fails to open
Event<ConnectionManager *> sp2plib::ConnectionManager::onSessionOpenSuccess |
Raised when session with Check Point server session becomes active
Raised when state track action (register/un-register tracking) fails
Event<ConnectionManager *, ConnectionManagerStatus> sp2plib::ConnectionManager::onStatusChange |
Raised each time servers status changes
PeerConnectCallback sp2plib::ConnectionManager::PeerAccepted |
Get of sets function pointer of type sp2plib::ConnectionManager::PeerConnect to call on peer acceptance as callback function