SLikeNet 0.1.3

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NatTypeDetectionClient.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
19
20
21 #include "NativeFeatureIncludes.h"
22 #if _RAKNET_SUPPORT_NatTypeDetectionClient==1
23
24 #ifndef __NAT_TYPE_DETECTION_CLIENT_H
25 #define __NAT_TYPE_DETECTION_CLIENT_H
26
27 #include "types.h"
28 #include "Export.h"
29 #include "PluginInterface2.h"
30 #include "PacketPriority.h"
31 #include "SocketIncludes.h"
32 #include "DS_OrderedList.h"
33 #include "string.h"
34 #include "NatTypeDetectionCommon.h"
35
36 namespace SLNet
37 {
39 class RakPeerInterface;
40 struct Packet;
41
50 class RAK_DLL_EXPORT NatTypeDetectionClient : public PluginInterface2, public RNS2EventHandler
51 {
52 public:
53
54 // GetInstance() and DestroyInstance(instance*)
55 STATIC_FACTORY_DECLARATIONS(NatTypeDetectionClient)
56
57 // Constructor
58 NatTypeDetectionClient();
59
60 // Destructor
61 virtual ~NatTypeDetectionClient();
62
67 void DetectNATType(SystemAddress _serverAddress);
68
70 virtual void Update(void);
71
73 virtual PluginReceiveResult OnReceive(Packet *packet);
74
75 virtual void OnClosedConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason );
76 virtual void OnRakPeerShutdown(void);
77 virtual void OnDetach(void);
78
79 virtual void OnRNS2Recv(RNS2RecvStruct *recvStruct);
80 virtual void DeallocRNS2RecvStruct(RNS2RecvStruct *s, const char *file, unsigned int line);
81 virtual RNS2RecvStruct *AllocRNS2RecvStruct(const char *file, unsigned int line);
82 protected:
83 DataStructures::Queue<RNS2RecvStruct*> bufferedPackets;
84 SimpleMutex bufferedPacketsMutex;
85
86 RakNetSocket2* c2;
87 //unsigned short c2Port;
88 void Shutdown(void);
89 void OnCompletion(NATTypeDetectionResult result);
90 bool IsInProgress(void) const;
91
92 void OnTestPortRestricted(Packet *packet);
93 SystemAddress serverAddress;
94 };
95
96
97 }
98
99
100 #endif
101
102 #endif // _RAKNET_SUPPORT_*