11 #include "RNPlatform/Inc/MemoryTracking.h"
14 #include "RNPlatform/Inc/MessageHelper.h"
15 #include "RNPlatform/Inc/Encryption.h"
16 #include "RNPlatform/Inc/ThreadClass.h"
17 #include "RNPlatform/Inc/Thread.h"
18 #include "RNXPSockets/Inc/XPSocket.h"
19 #include "RNPlatform/Inc/SysTime.h"
23 namespace RNReplicaNet
77 bool BeginAdvertise(
t_XPSocket *socket,
void *userPointer,
const bool isAdvertised,
const int globalID,
const int sessionID,
const int nonceID,
const bool externalHost =
true,
const XPAddress *optionalHost=0,
const bool persistant =
false);
90 bool BeginResolve(
t_XPSocket *socket,
void *userPointer,
const bool isAdvertised,
const int globalID,
const int sessionID,
const int nonceID,
const bool tryExternalHost =
true,
const XPAddress *optionalHost=0,
const XPAddress *optionalFirstTargetTry=0);
99 void ForgetResolve(
t_XPSocket *socket,
const bool isAdvertised,
const int globalID,
const int sessionID,
const int nonceID);
112 virtual void CallbackResolveFailed(
t_XPSocket *socket,
void *userPointer,
const int titleID,
const bool isAdvertised,
const int globalID,
const int sessionID,
const int nonceID);
116 virtual void CallbackResolveResult(
t_XPSocket *socket,
void *userPointer,
const XPAddress &targetAddress,
const int titleID,
const bool isAdvertised,
const int globalID,
const int sessionID,
const int nonceID);
122 int ThreadEntry(
void);
130 bool InsertState(NATState *state);
131 void DeleteState(NATState * &state);
140 bool operator()(
const NATState *a,
const NATState *b)
const;
145 bool operator()(
const NATState *a,
const NATState *b)
const;
148 struct ltIDsWithSocket
150 bool operator()(
const NATState *a,
const NATState *b)
const;
155 bool operator()(
const NATState *a,
const NATState *b)
const;
158 std::multiset<NATState *,ltSocket> mSetBySocket;
159 std::set<NATState *,ltIDs> mSetByIDs;
160 std::set<NATState *,ltIDsWithSocket> mSetByIDsWithSocket;
161 std::multiset<NATState *,ltUserPointer> mSetByUserPointer;
162 std::list<NATState *> mListByOrder;
164 bool BuildAndSendAdvertisePacket(
DynamicMessageHelper &message,NATState *state,PerHostState &hostState);
167 SysTimeType mBecameEmptyAt;
168 bool mAllowAutoThreadStop;
169 bool mAllowAutoHostSocketReads;
172 bool mServerAddressSet;
bool BeginResolve(t_XPSocket *socket, void *userPointer, const bool isAdvertised, const int globalID, const int sessionID, const int nonceID, const bool tryExternalHost=true, const XPAddress *optionalHost=0, const XPAddress *optionalFirstTargetTry=0)
void SetAutomaticThreadStop(const bool allow=true)
When the NATResolver becomes inactive for a period of time this allows the thread to stop processing...
void SetServer(const XPAddress &address)
void SetEncryptionKey(const void *data, const int length)
Definition: Encryption.h:27
Definition: XPSocket.h:91
virtual void CallbackResolveResult(t_XPSocket *socket, void *userPointer, const XPAddress &targetAddress, const int titleID, const bool isAdvertised, const int globalID, const int sessionID, const int nonceID)
void ForgetUserPointer(const void *userPointer)
Forgets all sockets with the same userPointer.
void SetAutomaticHostSocketReads(const bool allow=false)
void ForgetResolve(t_XPSocket *socket, const bool isAdvertised, const int globalID, const int sessionID, const int nonceID)
Removes the specific resolve request.
Definition: NATResolver.h:31
virtual void CallbackExternalAddressKnown(t_XPSocket *socket, void *userPointer, const XPAddress &externalAddress, const int titleID, const bool isAdvertised, const int globalID, const int sessionID, const int nonceID)
A virtual callback that is triggered when an advertised socket it told the external address from bein...
bool BeginAdvertise(t_XPSocket *socket, void *userPointer, const bool isAdvertised, const int globalID, const int sessionID, const int nonceID, const bool externalHost=true, const XPAddress *optionalHost=0, const bool persistant=false)
Advertises a socket with a set of identifying numbers (isAdvertised, globalID, nonceID) which should ...
bool BeginHosting(t_XPSocket *socket)
void ForgetSocket(const t_XPSocket *socket)
Removes the socket from the NATResolver index.
Definition: XPSocket.h:167
bool CallbackParsePacketData(t_XPSocket *socket, const XPAddress &addr, void *data, size_t length)
Definition: MessageHelper.h:211
virtual void CallbackResolveFailed(t_XPSocket *socket, void *userPointer, const int titleID, const bool isAdvertised, const int globalID, const int sessionID, const int nonceID)
A virtual callback that is triggered when a NAT resolve attempt fails.
Definition: ThreadClass.h:96