blob: 703ac28a1acdcdd26ffc704545c8f1c0062670b7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
#pragma once
#include "Runtime/Threads/Mutex.h"
#include "Configuration/UnityConfigure.h"
#include "Runtime/Network/Sockets.h"
#if ENABLE_NETWORK
#include "External/RakNet/builds/include/RakNetTypes.h"
#endif
void NetworkInitialize();
void NetworkCleanup();
std::string GetLocalIP();
int GetIPs(char ips[10][16]);
std::string GetHostName();
#if ENABLE_SOCKETS && !UNITY_WINRT
std::string InAddrToIP(sockaddr_in* in);
#endif
#if ENABLE_NETWORK
class MessageIdentifier;
bool CheckForPublicAddress();
char* DNSLookup(const char* domainName);
void ResolveAddress(SystemAddress& address, const char* domainName, const char* betaDomainName, const char* errorMessage);
unsigned short makeChecksum(unsigned short *buffer, int size);
void* PingImpl(void* data);
void SendToAllNetworkViews (const MessageIdentifier& msg, int inData);
void SendToAllNetworkViews (const MessageIdentifier& msg);
// The structure of the ICMP header. Mainly used to reference locations inside the ping packet.
struct icmpheader
{
unsigned char type;
unsigned char code;
unsigned short checksum;
unsigned short identifier;
unsigned short seq_num;
};
class Ping
{
int m_Time;
bool m_IsDone;
std::string m_IP;
int m_Refcount;
Mutex m_Mutex;
public:
Ping (const std::string& ip);
int GetTime();
void SetTime(int value);
int GetIsDone();
void SetIsDone(bool value);
std::string GetIP();
void Retain ();
void Release ();
};
#endif
|