1
0
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-19 19:59:09 +00:00

Change all CRLF-text files to LF-text files

to match H'uru for patching
This commit is contained in:
rarified
2021-01-28 12:08:00 -07:00
parent 6ae3df25f5
commit a553708b5b
3385 changed files with 1112046 additions and 1112046 deletions

View File

@ -1,143 +1,143 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
/*****************************************************************************
*
* $/Plasma20/Sources/Plasma/NucleusLib/pnNetDiag/Intern.h
*
***/
#ifdef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETDIAG_INTERN_H
#error "Header $/Plasma20/Sources/Plasma/NucleusLib/pnNetDiag/Intern.h included more than once"
#endif
#define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETDIAG_INTERN_H
namespace ND {
extern HMODULE g_lib;
extern const wchar g_version[];
//============================================================================
enum {
kDiagSrvAuth,
kDiagSrvFile,
kNumDiagSrvs
};
//============================================================================
inline unsigned NetProtocolToSrv (ENetProtocol protocol) {
switch (protocol) {
case kNetProtocolCli2Auth: return kDiagSrvAuth;
case kNetProtocolCli2File: return kDiagSrvFile;
default: return kNumDiagSrvs;
}
}
//============================================================================
inline const wchar * SrvToString (unsigned srv) {
switch (srv) {
case kDiagSrvAuth: return L"Auth";
case kDiagSrvFile: return L"File";
DEFAULT_FATAL(srv);
}
}
} using namespace ND;
//============================================================================
struct NetDiag : AtomicRef {
bool destroyed;
CCritSect critsect;
wchar * hosts[kNumDiagSrvs];
unsigned nodes[kNumDiagSrvs];
~NetDiag ();
void Destroy ();
void SetHost (unsigned srv, const wchar host[]);
};
/*****************************************************************************
*
* SYS
*
***/
void SysStartup ();
void SysShutdown ();
/*****************************************************************************
*
* DNS
*
***/
void DnsStartup ();
void DnsShutdown ();
/*****************************************************************************
*
* ICMP
*
***/
void IcmpStartup ();
void IcmpShutdown ();
/*****************************************************************************
*
* TCP
*
***/
void TcpStartup ();
void TcpShutdown ();
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
/*****************************************************************************
*
* $/Plasma20/Sources/Plasma/NucleusLib/pnNetDiag/Intern.h
*
***/
#ifdef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETDIAG_INTERN_H
#error "Header $/Plasma20/Sources/Plasma/NucleusLib/pnNetDiag/Intern.h included more than once"
#endif
#define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETDIAG_INTERN_H
namespace ND {
extern HMODULE g_lib;
extern const wchar g_version[];
//============================================================================
enum {
kDiagSrvAuth,
kDiagSrvFile,
kNumDiagSrvs
};
//============================================================================
inline unsigned NetProtocolToSrv (ENetProtocol protocol) {
switch (protocol) {
case kNetProtocolCli2Auth: return kDiagSrvAuth;
case kNetProtocolCli2File: return kDiagSrvFile;
default: return kNumDiagSrvs;
}
}
//============================================================================
inline const wchar * SrvToString (unsigned srv) {
switch (srv) {
case kDiagSrvAuth: return L"Auth";
case kDiagSrvFile: return L"File";
DEFAULT_FATAL(srv);
}
}
} using namespace ND;
//============================================================================
struct NetDiag : AtomicRef {
bool destroyed;
CCritSect critsect;
wchar * hosts[kNumDiagSrvs];
unsigned nodes[kNumDiagSrvs];
~NetDiag ();
void Destroy ();
void SetHost (unsigned srv, const wchar host[]);
};
/*****************************************************************************
*
* SYS
*
***/
void SysStartup ();
void SysShutdown ();
/*****************************************************************************
*
* DNS
*
***/
void DnsStartup ();
void DnsShutdown ();
/*****************************************************************************
*
* ICMP
*
***/
void IcmpStartup ();
void IcmpShutdown ();
/*****************************************************************************
*
* TCP
*
***/
void TcpStartup ();
void TcpShutdown ();

View File

@ -1,68 +1,68 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
/*****************************************************************************
*
* $/Plasma20/Sources/Plasma/NucleusLib/pnNetDiag/Pch.h
*
***/
#ifdef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETDIAG_PCH_H
#error "Header $/Plasma20/Sources/Plasma/NucleusLib/pnNetDiag/Pch.h included more than once"
#endif
#define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETDIAG_PCH_H
#include "pnUtils/pnUtils.h"
#include "pnNetBase/pnNetBase.h"
#include "pnAsyncCore/pnAsyncCore.h"
#include "pnProduct/pnProduct.h"
#include "pnNetCli/pnNetCli.h"
#define USES_PROTOCOL_CLI2AUTH
#define USES_PROTOCOL_CLI2FILE
#include "pnNetProtocol/pnNetProtocol.h"
#include "pnNetDiag.h"
#include "Intern.h"
#include <process.h>
#include <IPExport.h>
#include <IPTypes.h>
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
/*****************************************************************************
*
* $/Plasma20/Sources/Plasma/NucleusLib/pnNetDiag/Pch.h
*
***/
#ifdef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETDIAG_PCH_H
#error "Header $/Plasma20/Sources/Plasma/NucleusLib/pnNetDiag/Pch.h included more than once"
#endif
#define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETDIAG_PCH_H
#include "pnUtils/pnUtils.h"
#include "pnNetBase/pnNetBase.h"
#include "pnAsyncCore/pnAsyncCore.h"
#include "pnProduct/pnProduct.h"
#include "pnNetCli/pnNetCli.h"
#define USES_PROTOCOL_CLI2AUTH
#define USES_PROTOCOL_CLI2FILE
#include "pnNetProtocol/pnNetProtocol.h"
#include "pnNetDiag.h"
#include "Intern.h"
#include <process.h>
#include <IPExport.h>
#include <IPTypes.h>

View File

@ -1,196 +1,196 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
/*****************************************************************************
*
* $/Plasma20/Sources/Plasma/NucleusLib/pnNetDiag/pnNdDns.cpp
*
***/
#include "Pch.h"
#pragma hdrstop
/*****************************************************************************
*
* Internal types
*
***/
struct DNSParam {
NetDiag * diag;
FNetDiagDumpProc dump;
FNetDiagTestCallback callback;
void * param;
ENetProtocol protocol;
unsigned srv;
};
/*****************************************************************************
*
* Internal functions
*
***/
//============================================================================
static void LookupCallback (
void * param,
const wchar name[],
unsigned addrCount,
const NetAddress addrs[]
) {
REF(name);
DNSParam * p = (DNSParam *)param;
if (addrCount) {
unsigned node = NetAddressGetNode(addrs[0]);
p->diag->critsect.Enter();
{
p->diag->nodes[p->srv] = node;
}
p->diag->critsect.Leave();
wchar nodeStr[64];
NetAddressNodeToString(p->diag->nodes[p->srv], nodeStr, arrsize(nodeStr));
p->dump(L"[DNS] Success. %s --> %s", name, nodeStr);
p->callback(
p->diag,
p->protocol,
kNetSuccess,
p->param
);
}
else {
p->diag->critsect.Enter();
{
// if the hostname still matches, then clear the node
if (p->diag->hosts[p->srv] && 0 == StrCmp(p->diag->hosts[p->srv], name))
p->diag->nodes[p->srv] = 0;
}
p->diag->critsect.Leave();
p->dump(L"[DNS] Failed to resolve hostname %s", name);
p->callback(
p->diag,
p->protocol,
kNetErrNameLookupFailed,
p->param
);
}
p->diag->DecRef("DNS");
DEL(p);
}
/*****************************************************************************
*
* Module functions
*
***/
//============================================================================
void DnsStartup () {
}
//============================================================================
void DnsShutdown () {
}
/*****************************************************************************
*
* Exports
*
***/
//============================================================================
void NetDiagDns (
NetDiag * diag,
ENetProtocol protocol,
FNetDiagDumpProc dump,
FNetDiagTestCallback callback,
void * param
) {
ASSERT(diag);
ASSERT(dump);
ASSERT(callback);
unsigned srv = NetProtocolToSrv(protocol);
if (srv == kNumDiagSrvs) {
dump(L"[DNS] Unsupported protocol: %s", NetProtocolToString(protocol));
callback(diag, protocol, kNetErrNotSupported, param);
return;
}
wchar * host = nil;
diag->critsect.Enter();
{
if (diag->hosts[srv])
host = StrDup(diag->hosts[srv]);
}
diag->critsect.Leave();
if (!host) {
dump(L"[DNS] No hostname set for protocol: %s", NetProtocolToString(protocol));
callback(diag, protocol, kNetSuccess, param);
return;
}
diag->IncRef("DNS");
dump(L"[DNS] Looking up %s...", host);
DNSParam * dnsParam = NEWZERO(DNSParam);
dnsParam->diag = diag;
dnsParam->srv = srv;
dnsParam->protocol = protocol;
dnsParam->dump = dump;
dnsParam->callback = callback;
dnsParam->param = param;
AsyncCancelId cancelId;
AsyncAddressLookupName(
&cancelId,
LookupCallback,
host,
0,
dnsParam
);
FREE(host);
}
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
/*****************************************************************************
*
* $/Plasma20/Sources/Plasma/NucleusLib/pnNetDiag/pnNdDns.cpp
*
***/
#include "Pch.h"
#pragma hdrstop
/*****************************************************************************
*
* Internal types
*
***/
struct DNSParam {
NetDiag * diag;
FNetDiagDumpProc dump;
FNetDiagTestCallback callback;
void * param;
ENetProtocol protocol;
unsigned srv;
};
/*****************************************************************************
*
* Internal functions
*
***/
//============================================================================
static void LookupCallback (
void * param,
const wchar name[],
unsigned addrCount,
const NetAddress addrs[]
) {
REF(name);
DNSParam * p = (DNSParam *)param;
if (addrCount) {
unsigned node = NetAddressGetNode(addrs[0]);
p->diag->critsect.Enter();
{
p->diag->nodes[p->srv] = node;
}
p->diag->critsect.Leave();
wchar nodeStr[64];
NetAddressNodeToString(p->diag->nodes[p->srv], nodeStr, arrsize(nodeStr));
p->dump(L"[DNS] Success. %s --> %s", name, nodeStr);
p->callback(
p->diag,
p->protocol,
kNetSuccess,
p->param
);
}
else {
p->diag->critsect.Enter();
{
// if the hostname still matches, then clear the node
if (p->diag->hosts[p->srv] && 0 == StrCmp(p->diag->hosts[p->srv], name))
p->diag->nodes[p->srv] = 0;
}
p->diag->critsect.Leave();
p->dump(L"[DNS] Failed to resolve hostname %s", name);
p->callback(
p->diag,
p->protocol,
kNetErrNameLookupFailed,
p->param
);
}
p->diag->DecRef("DNS");
DEL(p);
}
/*****************************************************************************
*
* Module functions
*
***/
//============================================================================
void DnsStartup () {
}
//============================================================================
void DnsShutdown () {
}
/*****************************************************************************
*
* Exports
*
***/
//============================================================================
void NetDiagDns (
NetDiag * diag,
ENetProtocol protocol,
FNetDiagDumpProc dump,
FNetDiagTestCallback callback,
void * param
) {
ASSERT(diag);
ASSERT(dump);
ASSERT(callback);
unsigned srv = NetProtocolToSrv(protocol);
if (srv == kNumDiagSrvs) {
dump(L"[DNS] Unsupported protocol: %s", NetProtocolToString(protocol));
callback(diag, protocol, kNetErrNotSupported, param);
return;
}
wchar * host = nil;
diag->critsect.Enter();
{
if (diag->hosts[srv])
host = StrDup(diag->hosts[srv]);
}
diag->critsect.Leave();
if (!host) {
dump(L"[DNS] No hostname set for protocol: %s", NetProtocolToString(protocol));
callback(diag, protocol, kNetSuccess, param);
return;
}
diag->IncRef("DNS");
dump(L"[DNS] Looking up %s...", host);
DNSParam * dnsParam = NEWZERO(DNSParam);
dnsParam->diag = diag;
dnsParam->srv = srv;
dnsParam->protocol = protocol;
dnsParam->dump = dump;
dnsParam->callback = callback;
dnsParam->param = param;
AsyncCancelId cancelId;
AsyncAddressLookupName(
&cancelId,
LookupCallback,
host,
0,
dnsParam
);
FREE(host);
}

View File

@ -1,262 +1,262 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
/*****************************************************************************
*
* $/Plasma20/Sources/Plasma/NucleusLib/pnNetDiag/pnNdIcmp.cpp
*
***/
#include "Pch.h"
#pragma hdrstop
/*****************************************************************************
*
* Local types
*
***/
typedef HANDLE (PASCAL FAR * FIcmpCreateFile) ();
typedef DWORD (PASCAL FAR * FIcmpSendEcho) (
HANDLE icmpHandle,
DWORD destinationAddress,
LPVOID requestData,
WORD requestSize,
PIP_OPTION_INFORMATION options,
LPVOID replyBuffer,
DWORD replySize,
DWORD timeoutMs
);
struct PingParam {
NetDiag * diag;
FNetDiagDumpProc dump;
FNetDiagTestCallback callback;
void * param;
ENetProtocol protocol;
unsigned srv;
};
/*****************************************************************************
*
* Local data
*
***/
static const unsigned kPingCount = 5;
static const unsigned kPayloadBytes = 32;
static FIcmpCreateFile IcmpCreateFile;
static FIcmpSendEcho IcmpSendEcho;
static byte s_payload[kPayloadBytes];
/*****************************************************************************
*
* Local functions
*
***/
//============================================================================
static const wchar * IpStatusToString (ULONG status) {
switch (status) {
case IP_SUCCESS: return L"IP_SUCCESS";
case IP_BUF_TOO_SMALL: return L"IP_BUF_TOO_SMALL";
case IP_DEST_NET_UNREACHABLE: return L"IP_DEST_NET_UNREACHABLE";
case IP_DEST_HOST_UNREACHABLE: return L"IP_DEST_HOST_UNREACHABLE";
case IP_DEST_PROT_UNREACHABLE: return L"IP_DEST_PROT_UNREACHABLE";
case IP_DEST_PORT_UNREACHABLE: return L"IP_DEST_PORT_UNREACHABLE";
case IP_NO_RESOURCES: return L"IP_NO_RESOURCES";
case IP_BAD_OPTION: return L"IP_BAD_OPTION";
case IP_HW_ERROR: return L"IP_HW_ERROR";
case IP_PACKET_TOO_BIG: return L"IP_PACKET_TOO_BIG";
case IP_REQ_TIMED_OUT: return L"IP_REQ_TIMED_OUT";
case IP_BAD_REQ: return L"IP_BAD_REQ";
case IP_BAD_ROUTE: return L"IP_BAD_ROUTE";
case IP_TTL_EXPIRED_TRANSIT: return L"IP_TTL_EXPIRED_TRANSIT";
case IP_TTL_EXPIRED_REASSEM: return L"IP_TTL_EXPIRED_REASSEM";
case IP_PARAM_PROBLEM: return L"IP_PARAM_PROBLEM";
case IP_SOURCE_QUENCH: return L"IP_SOURCE_QUENCH";
case IP_OPTION_TOO_BIG: return L"IP_OPTION_TOO_BIG";
case IP_BAD_DESTINATION: return L"IP_BAD_DESTINATION";
default: return L"Unknown error";
}
}
//============================================================================
static void __cdecl PingThreadProc (void * param) {
PingParam * p = (PingParam *)param;
HANDLE icmp = IcmpCreateFile();
if (!icmp) {
p->dump(L"[ICMP] Failed to create ICMP handle");
p->callback(p->diag, p->protocol, kNetErrFileNotFound, p->param);
return;
}
char addr[64];
wchar waddr[64];
NetAddressNodeToString(p->diag->nodes[p->srv], waddr, arrsize(waddr));
StrToAnsi(addr, waddr, arrsize(addr));
ENetError result = kNetSuccess;
byte reply[kPayloadBytes + sizeof(ICMP_ECHO_REPLY)];
for (unsigned i = 0; i < kPingCount; ++i) {
DWORD retval = IcmpSendEcho(
icmp,
inet_addr(addr),
s_payload,
sizeof(s_payload),
NULL,
reply,
sizeof(reply),
4000
);
PICMP_ECHO_REPLY pEchoReply = (PICMP_ECHO_REPLY)reply;
if (retval) {
p->dump(L"[ICMP] Reply from %s. ms=%u", waddr, pEchoReply->RoundTripTime);
}
else {
result = kNetErrConnectFailed;
p->dump(L"[ICMP] No reply from %s. %s", waddr, IpStatusToString(pEchoReply->Status));
}
}
p->callback(p->diag, p->protocol, result, p->param);
p->diag->DecRef("ICMP");
DEL(p);
}
/*****************************************************************************
*
* Module functions
*
***/
//============================================================================
void IcmpStartup () {
if (g_lib) {
IcmpCreateFile = (FIcmpCreateFile)GetProcAddress(g_lib, "IcmpCreateFile");
IcmpSendEcho = (FIcmpSendEcho)GetProcAddress(g_lib, "IcmpSendEcho");
}
MemSet(s_payload, (byte)((unsigned_ptr)&s_payload >> 4), arrsize(s_payload));
}
//============================================================================
void IcmpShutdown () {
IcmpCreateFile = nil;
IcmpSendEcho = nil;
}
/*****************************************************************************
*
* Exports
*
***/
//============================================================================
void NetDiagIcmp (
NetDiag * diag,
ENetProtocol protocol,
FNetDiagDumpProc dump,
FNetDiagTestCallback callback,
void * param
) {
ASSERT(diag);
ASSERT(dump);
ASSERT(callback);
if (!IcmpCreateFile || !IcmpSendEcho) {
dump(L"[ICMP] Failed to load IP helper API");
callback(diag, protocol, kNetErrNotSupported, param);
return;
}
unsigned srv = NetProtocolToSrv(protocol);
if (srv == kNumDiagSrvs) {
dump(L"[ICMP] Unsupported protocol: %s", NetProtocolToString(protocol));
callback(diag, protocol, kNetErrNotSupported, param);
return;
}
unsigned node = 0;
diag->critsect.Enter();
{
node = diag->nodes[srv];
}
diag->critsect.Leave();
if (!node) {
dump(L"[ICMP] No address set for protocol: %s", NetProtocolToString(protocol));
callback(diag, protocol, kNetSuccess, param);
return;
}
wchar nodeStr[64];
NetAddressNodeToString(node, nodeStr, arrsize(nodeStr));
dump(L"[ICMP] Pinging %s with %u bytes of data...", nodeStr, kPayloadBytes);
PingParam * pingParam = NEWZERO(PingParam);
pingParam->diag = diag;
pingParam->srv = srv;
pingParam->protocol = protocol;
pingParam->dump = dump;
pingParam->callback = callback;
pingParam->param = param;
diag->IncRef("ICMP");
_beginthread(PingThreadProc, 0, pingParam);
}
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
/*****************************************************************************
*
* $/Plasma20/Sources/Plasma/NucleusLib/pnNetDiag/pnNdIcmp.cpp
*
***/
#include "Pch.h"
#pragma hdrstop
/*****************************************************************************
*
* Local types
*
***/
typedef HANDLE (PASCAL FAR * FIcmpCreateFile) ();
typedef DWORD (PASCAL FAR * FIcmpSendEcho) (
HANDLE icmpHandle,
DWORD destinationAddress,
LPVOID requestData,
WORD requestSize,
PIP_OPTION_INFORMATION options,
LPVOID replyBuffer,
DWORD replySize,
DWORD timeoutMs
);
struct PingParam {
NetDiag * diag;
FNetDiagDumpProc dump;
FNetDiagTestCallback callback;
void * param;
ENetProtocol protocol;
unsigned srv;
};
/*****************************************************************************
*
* Local data
*
***/
static const unsigned kPingCount = 5;
static const unsigned kPayloadBytes = 32;
static FIcmpCreateFile IcmpCreateFile;
static FIcmpSendEcho IcmpSendEcho;
static byte s_payload[kPayloadBytes];
/*****************************************************************************
*
* Local functions
*
***/
//============================================================================
static const wchar * IpStatusToString (ULONG status) {
switch (status) {
case IP_SUCCESS: return L"IP_SUCCESS";
case IP_BUF_TOO_SMALL: return L"IP_BUF_TOO_SMALL";
case IP_DEST_NET_UNREACHABLE: return L"IP_DEST_NET_UNREACHABLE";
case IP_DEST_HOST_UNREACHABLE: return L"IP_DEST_HOST_UNREACHABLE";
case IP_DEST_PROT_UNREACHABLE: return L"IP_DEST_PROT_UNREACHABLE";
case IP_DEST_PORT_UNREACHABLE: return L"IP_DEST_PORT_UNREACHABLE";
case IP_NO_RESOURCES: return L"IP_NO_RESOURCES";
case IP_BAD_OPTION: return L"IP_BAD_OPTION";
case IP_HW_ERROR: return L"IP_HW_ERROR";
case IP_PACKET_TOO_BIG: return L"IP_PACKET_TOO_BIG";
case IP_REQ_TIMED_OUT: return L"IP_REQ_TIMED_OUT";
case IP_BAD_REQ: return L"IP_BAD_REQ";
case IP_BAD_ROUTE: return L"IP_BAD_ROUTE";
case IP_TTL_EXPIRED_TRANSIT: return L"IP_TTL_EXPIRED_TRANSIT";
case IP_TTL_EXPIRED_REASSEM: return L"IP_TTL_EXPIRED_REASSEM";
case IP_PARAM_PROBLEM: return L"IP_PARAM_PROBLEM";
case IP_SOURCE_QUENCH: return L"IP_SOURCE_QUENCH";
case IP_OPTION_TOO_BIG: return L"IP_OPTION_TOO_BIG";
case IP_BAD_DESTINATION: return L"IP_BAD_DESTINATION";
default: return L"Unknown error";
}
}
//============================================================================
static void __cdecl PingThreadProc (void * param) {
PingParam * p = (PingParam *)param;
HANDLE icmp = IcmpCreateFile();
if (!icmp) {
p->dump(L"[ICMP] Failed to create ICMP handle");
p->callback(p->diag, p->protocol, kNetErrFileNotFound, p->param);
return;
}
char addr[64];
wchar waddr[64];
NetAddressNodeToString(p->diag->nodes[p->srv], waddr, arrsize(waddr));
StrToAnsi(addr, waddr, arrsize(addr));
ENetError result = kNetSuccess;
byte reply[kPayloadBytes + sizeof(ICMP_ECHO_REPLY)];
for (unsigned i = 0; i < kPingCount; ++i) {
DWORD retval = IcmpSendEcho(
icmp,
inet_addr(addr),
s_payload,
sizeof(s_payload),
NULL,
reply,
sizeof(reply),
4000
);
PICMP_ECHO_REPLY pEchoReply = (PICMP_ECHO_REPLY)reply;
if (retval) {
p->dump(L"[ICMP] Reply from %s. ms=%u", waddr, pEchoReply->RoundTripTime);
}
else {
result = kNetErrConnectFailed;
p->dump(L"[ICMP] No reply from %s. %s", waddr, IpStatusToString(pEchoReply->Status));
}
}
p->callback(p->diag, p->protocol, result, p->param);
p->diag->DecRef("ICMP");
DEL(p);
}
/*****************************************************************************
*
* Module functions
*
***/
//============================================================================
void IcmpStartup () {
if (g_lib) {
IcmpCreateFile = (FIcmpCreateFile)GetProcAddress(g_lib, "IcmpCreateFile");
IcmpSendEcho = (FIcmpSendEcho)GetProcAddress(g_lib, "IcmpSendEcho");
}
MemSet(s_payload, (byte)((unsigned_ptr)&s_payload >> 4), arrsize(s_payload));
}
//============================================================================
void IcmpShutdown () {
IcmpCreateFile = nil;
IcmpSendEcho = nil;
}
/*****************************************************************************
*
* Exports
*
***/
//============================================================================
void NetDiagIcmp (
NetDiag * diag,
ENetProtocol protocol,
FNetDiagDumpProc dump,
FNetDiagTestCallback callback,
void * param
) {
ASSERT(diag);
ASSERT(dump);
ASSERT(callback);
if (!IcmpCreateFile || !IcmpSendEcho) {
dump(L"[ICMP] Failed to load IP helper API");
callback(diag, protocol, kNetErrNotSupported, param);
return;
}
unsigned srv = NetProtocolToSrv(protocol);
if (srv == kNumDiagSrvs) {
dump(L"[ICMP] Unsupported protocol: %s", NetProtocolToString(protocol));
callback(diag, protocol, kNetErrNotSupported, param);
return;
}
unsigned node = 0;
diag->critsect.Enter();
{
node = diag->nodes[srv];
}
diag->critsect.Leave();
if (!node) {
dump(L"[ICMP] No address set for protocol: %s", NetProtocolToString(protocol));
callback(diag, protocol, kNetSuccess, param);
return;
}
wchar nodeStr[64];
NetAddressNodeToString(node, nodeStr, arrsize(nodeStr));
dump(L"[ICMP] Pinging %s with %u bytes of data...", nodeStr, kPayloadBytes);
PingParam * pingParam = NEWZERO(PingParam);
pingParam->diag = diag;
pingParam->srv = srv;
pingParam->protocol = protocol;
pingParam->dump = dump;
pingParam->callback = callback;
pingParam->param = param;
diag->IncRef("ICMP");
_beginthread(PingThreadProc, 0, pingParam);
}

File diff suppressed because it is too large Load Diff

View File

@ -1,167 +1,167 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
/*****************************************************************************
*
* $/Plasma20/Sources/Plasma/NucleusLib/pnNetDiag/pnNetDiag.cpp
*
***/
#include "Pch.h"
#pragma hdrstop
namespace ND {
/*****************************************************************************
*
* Local data
*
***/
/*****************************************************************************
*
* Module data
*
***/
HMODULE g_lib;
//const wchar g_version[] = L"miasma";
//const wchar g_version[] = L"ectomorph";
const wchar g_version[] = L"solvent";
} // namespace ND
/*****************************************************************************
*
* NetDiag
*
***/
//============================================================================
NetDiag::~NetDiag () {
for (unsigned srv = 0; srv < kNumDiagSrvs; ++srv)
FREE(hosts[srv]);
}
//============================================================================
void NetDiag::SetHost (unsigned srv, const wchar host[]) {
critsect.Enter();
{
FREE(hosts[srv]);
if (host)
hosts[srv] = StrDup(host);
else
hosts[srv] = nil;
nodes[srv] = 0;
}
critsect.Leave();
}
/*****************************************************************************
*
* Exports
*
***/
//============================================================================
void NetDiagInitialize () {
g_lib = LoadLibrary("Iphlpapi.dll");
SysStartup();
DnsStartup();
IcmpStartup();
TcpStartup();
}
//============================================================================
void NetDiagDestroy () {
TcpShutdown();
IcmpShutdown();
DnsShutdown();
SysShutdown();
if (g_lib) {
FreeLibrary(g_lib);
g_lib = nil;
}
}
//============================================================================
NetDiag * NetDiagCreate () {
NetDiag * diag = NEWZERO(NetDiag);
diag->IncRef("Lifetime");
return diag;
}
//============================================================================
void NetDiagDelete (NetDiag * diag) {
ASSERT(!diag->destroyed);
diag->destroyed = true;
diag->DecRef("Lifetime");
}
//============================================================================
void NetDiagSetHost (
NetDiag * diag,
ENetProtocol protocol,
const wchar host[]
) {
ASSERT(diag);
unsigned srv = NetProtocolToSrv(protocol);
if (srv == kNumDiagSrvs)
return;
diag->SetHost(srv, host);
}
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
/*****************************************************************************
*
* $/Plasma20/Sources/Plasma/NucleusLib/pnNetDiag/pnNetDiag.cpp
*
***/
#include "Pch.h"
#pragma hdrstop
namespace ND {
/*****************************************************************************
*
* Local data
*
***/
/*****************************************************************************
*
* Module data
*
***/
HMODULE g_lib;
//const wchar g_version[] = L"miasma";
//const wchar g_version[] = L"ectomorph";
const wchar g_version[] = L"solvent";
} // namespace ND
/*****************************************************************************
*
* NetDiag
*
***/
//============================================================================
NetDiag::~NetDiag () {
for (unsigned srv = 0; srv < kNumDiagSrvs; ++srv)
FREE(hosts[srv]);
}
//============================================================================
void NetDiag::SetHost (unsigned srv, const wchar host[]) {
critsect.Enter();
{
FREE(hosts[srv]);
if (host)
hosts[srv] = StrDup(host);
else
hosts[srv] = nil;
nodes[srv] = 0;
}
critsect.Leave();
}
/*****************************************************************************
*
* Exports
*
***/
//============================================================================
void NetDiagInitialize () {
g_lib = LoadLibrary("Iphlpapi.dll");
SysStartup();
DnsStartup();
IcmpStartup();
TcpStartup();
}
//============================================================================
void NetDiagDestroy () {
TcpShutdown();
IcmpShutdown();
DnsShutdown();
SysShutdown();
if (g_lib) {
FreeLibrary(g_lib);
g_lib = nil;
}
}
//============================================================================
NetDiag * NetDiagCreate () {
NetDiag * diag = NEWZERO(NetDiag);
diag->IncRef("Lifetime");
return diag;
}
//============================================================================
void NetDiagDelete (NetDiag * diag) {
ASSERT(!diag->destroyed);
diag->destroyed = true;
diag->DecRef("Lifetime");
}
//============================================================================
void NetDiagSetHost (
NetDiag * diag,
ENetProtocol protocol,
const wchar host[]
) {
ASSERT(diag);
unsigned srv = NetProtocolToSrv(protocol);
if (srv == kNumDiagSrvs)
return;
diag->SetHost(srv, host);
}

View File

@ -1,145 +1,145 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
/*****************************************************************************
*
* $/Plasma20/Sources/Plasma/NucleusLib/pnNetDiag/pnNetDiag.h
*
***/
#ifndef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETDIAG_PNNETDIAG_H
#define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETDIAG_PNNETDIAG_H
#define PNNETDIAG_INCLUDED
#ifdef PLNETGAMELIB_INCLUDED
#error "pnNetDiag and plNetGameLib libraries may not be included in the same project because they invalidate each other's pnNetCli settings"
#endif
/*****************************************************************************
*
* Module
*
***/
void NetDiagInitialize ();
void NetDiagDestroy ();
/*****************************************************************************
*
* NetDiag
*
***/
struct NetDiag;
NetDiag * NetDiagCreate ();
void NetDiagDelete (NetDiag * diag);
void NetDiagSetHost (
NetDiag * diag,
ENetProtocol protocol,
const wchar name[]
);
typedef void ( __cdecl * FNetDiagDumpProc)(
const wchar fmt[],
...
);
typedef void (*FNetDiagTestCallback)(
NetDiag * diag,
ENetProtocol protocol,
ENetError result,
void * param
);
//============================================================================
// Test: SYS
// Gather system information
//============================================================================
void NetDiagSys (
NetDiag * diag,
FNetDiagDumpProc dump,
FNetDiagTestCallback callback,
void * param
);
//============================================================================
// Test: DNS
// Lookup server address
//============================================================================
void NetDiagDns (
NetDiag * diag,
ENetProtocol protocol,
FNetDiagDumpProc dump,
FNetDiagTestCallback callback,
void * param
);
//============================================================================
// Test: ICMP
// Send out 5 sequential ICMP ping packets to the server
//============================================================================
void NetDiagIcmp (
NetDiag * diag,
ENetProtocol protocol,
FNetDiagDumpProc dump,
FNetDiagTestCallback callback,
void * param
);
//============================================================================
// Test: TCP
// Connect to server and measure bandwidth
//============================================================================
void NetDiagTcp (
NetDiag * diag,
ENetProtocol protocol,
unsigned port, // 0 --> use default client port
FNetDiagDumpProc dump,
FNetDiagTestCallback callback,
void * param
);
#endif // PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETDIAG_PNNETDIAG_H
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
/*****************************************************************************
*
* $/Plasma20/Sources/Plasma/NucleusLib/pnNetDiag/pnNetDiag.h
*
***/
#ifndef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETDIAG_PNNETDIAG_H
#define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETDIAG_PNNETDIAG_H
#define PNNETDIAG_INCLUDED
#ifdef PLNETGAMELIB_INCLUDED
#error "pnNetDiag and plNetGameLib libraries may not be included in the same project because they invalidate each other's pnNetCli settings"
#endif
/*****************************************************************************
*
* Module
*
***/
void NetDiagInitialize ();
void NetDiagDestroy ();
/*****************************************************************************
*
* NetDiag
*
***/
struct NetDiag;
NetDiag * NetDiagCreate ();
void NetDiagDelete (NetDiag * diag);
void NetDiagSetHost (
NetDiag * diag,
ENetProtocol protocol,
const wchar name[]
);
typedef void ( __cdecl * FNetDiagDumpProc)(
const wchar fmt[],
...
);
typedef void (*FNetDiagTestCallback)(
NetDiag * diag,
ENetProtocol protocol,
ENetError result,
void * param
);
//============================================================================
// Test: SYS
// Gather system information
//============================================================================
void NetDiagSys (
NetDiag * diag,
FNetDiagDumpProc dump,
FNetDiagTestCallback callback,
void * param
);
//============================================================================
// Test: DNS
// Lookup server address
//============================================================================
void NetDiagDns (
NetDiag * diag,
ENetProtocol protocol,
FNetDiagDumpProc dump,
FNetDiagTestCallback callback,
void * param
);
//============================================================================
// Test: ICMP
// Send out 5 sequential ICMP ping packets to the server
//============================================================================
void NetDiagIcmp (
NetDiag * diag,
ENetProtocol protocol,
FNetDiagDumpProc dump,
FNetDiagTestCallback callback,
void * param
);
//============================================================================
// Test: TCP
// Connect to server and measure bandwidth
//============================================================================
void NetDiagTcp (
NetDiag * diag,
ENetProtocol protocol,
unsigned port, // 0 --> use default client port
FNetDiagDumpProc dump,
FNetDiagTestCallback callback,
void * param
);
#endif // PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETDIAG_PNNETDIAG_H

View File

@ -1,177 +1,177 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
/*****************************************************************************
*
* $/Plasma20/Sources/Plasma/NucleusLib/pnNetDiag/pnNetSys.cpp
*
***/
#include "Pch.h"
#pragma hdrstop
/*****************************************************************************
*
* Local types
*
***/
typedef DWORD (PASCAL FAR * FGetAdaptersInfo)(
PIP_ADAPTER_INFO pAdapterInfo,
PULONG pOutBufLen
);
/*****************************************************************************
*
* Local data
*
***/
static FGetAdaptersInfo GetAdaptersInfo;
/*****************************************************************************
*
* Module functions
*
***/
//============================================================================
void SysStartup () {
if (g_lib) {
GetAdaptersInfo = (FGetAdaptersInfo)GetProcAddress(g_lib, "GetAdaptersInfo");
}
}
//============================================================================
void SysShutdown () {
GetAdaptersInfo = nil;
}
/*****************************************************************************
*
* Exports
*
***/
//============================================================================
void NetDiagSys (
NetDiag * diag,
FNetDiagDumpProc dump,
FNetDiagTestCallback callback,
void * param
) {
ASSERT(diag);
ASSERT(dump);
ASSERT(callback);
{ // Timestamp
wchar str[256];
qword time = TimeGetTime();
TimePrettyPrint(time, arrsize(str), str);
dump(L"[SYS] Time: %s UTC", str);
}
{ // Command line
dump(L"[SYS] Cmdline: %s", AppGetCommandLine());
}
{ // Product
wchar product[128];
ProductString(product, arrsize(product));
dump(L"[SYS] Product: %s", product);
}
{ // pnNetDiag version
dump(L"[SYS] Cognomen: '%s'", g_version);
}
{ // OS
OSVERSIONINFOEX info;
info.dwOSVersionInfoSize = sizeof(info);
GetVersionEx((OSVERSIONINFO*)&info);
dump(L"[SYS] OS Version: %u.%u", info.dwMajorVersion, info.dwMinorVersion);
dump(L"[SYS] OS Patch: %u.%u (%S)", info.wServicePackMajor, info.wServicePackMinor, info.szCSDVersion);
}
{ // System
word cpuCaps;
dword cpuVendor[3];
word cpuSignature;
CpuGetInfo(&cpuCaps, cpuVendor, &cpuSignature);
SYSTEM_INFO info;
GetSystemInfo(&info);
dump(L"[SYS] CPU Count: %u", info.dwNumberOfProcessors);
dump(L"[SYS] CPU Vendor: %.*S", sizeof(cpuVendor), cpuVendor);
}
{ // Adapters
if (!GetAdaptersInfo) {
dump(L"[SYS] Failed to load IP helper API");
callback(diag, kNetProtocolNil, kNetErrNotSupported, param);
return;
}
ULONG ulOutBufLen = 0;
GetAdaptersInfo(nil, &ulOutBufLen);
PIP_ADAPTER_INFO pInfo = (PIP_ADAPTER_INFO)ALLOC(ulOutBufLen);
PIP_ADAPTER_INFO pAdapter;
if (GetAdaptersInfo(pInfo, &ulOutBufLen) == NO_ERROR) {
pAdapter = pInfo;
while (pAdapter) {
dump(L"[SYS] NIC: %S", pAdapter->Description);
pAdapter = pAdapter->Next;
}
callback(diag, kNetProtocolNil, kNetSuccess, param);
}
else {
dump(L"[SYS] Error getting adaper list");
callback(diag, kNetProtocolNil, kNetErrFileNotFound, param);
}
FREE(pInfo);
}
}
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
/*****************************************************************************
*
* $/Plasma20/Sources/Plasma/NucleusLib/pnNetDiag/pnNetSys.cpp
*
***/
#include "Pch.h"
#pragma hdrstop
/*****************************************************************************
*
* Local types
*
***/
typedef DWORD (PASCAL FAR * FGetAdaptersInfo)(
PIP_ADAPTER_INFO pAdapterInfo,
PULONG pOutBufLen
);
/*****************************************************************************
*
* Local data
*
***/
static FGetAdaptersInfo GetAdaptersInfo;
/*****************************************************************************
*
* Module functions
*
***/
//============================================================================
void SysStartup () {
if (g_lib) {
GetAdaptersInfo = (FGetAdaptersInfo)GetProcAddress(g_lib, "GetAdaptersInfo");
}
}
//============================================================================
void SysShutdown () {
GetAdaptersInfo = nil;
}
/*****************************************************************************
*
* Exports
*
***/
//============================================================================
void NetDiagSys (
NetDiag * diag,
FNetDiagDumpProc dump,
FNetDiagTestCallback callback,
void * param
) {
ASSERT(diag);
ASSERT(dump);
ASSERT(callback);
{ // Timestamp
wchar str[256];
qword time = TimeGetTime();
TimePrettyPrint(time, arrsize(str), str);
dump(L"[SYS] Time: %s UTC", str);
}
{ // Command line
dump(L"[SYS] Cmdline: %s", AppGetCommandLine());
}
{ // Product
wchar product[128];
ProductString(product, arrsize(product));
dump(L"[SYS] Product: %s", product);
}
{ // pnNetDiag version
dump(L"[SYS] Cognomen: '%s'", g_version);
}
{ // OS
OSVERSIONINFOEX info;
info.dwOSVersionInfoSize = sizeof(info);
GetVersionEx((OSVERSIONINFO*)&info);
dump(L"[SYS] OS Version: %u.%u", info.dwMajorVersion, info.dwMinorVersion);
dump(L"[SYS] OS Patch: %u.%u (%S)", info.wServicePackMajor, info.wServicePackMinor, info.szCSDVersion);
}
{ // System
word cpuCaps;
dword cpuVendor[3];
word cpuSignature;
CpuGetInfo(&cpuCaps, cpuVendor, &cpuSignature);
SYSTEM_INFO info;
GetSystemInfo(&info);
dump(L"[SYS] CPU Count: %u", info.dwNumberOfProcessors);
dump(L"[SYS] CPU Vendor: %.*S", sizeof(cpuVendor), cpuVendor);
}
{ // Adapters
if (!GetAdaptersInfo) {
dump(L"[SYS] Failed to load IP helper API");
callback(diag, kNetProtocolNil, kNetErrNotSupported, param);
return;
}
ULONG ulOutBufLen = 0;
GetAdaptersInfo(nil, &ulOutBufLen);
PIP_ADAPTER_INFO pInfo = (PIP_ADAPTER_INFO)ALLOC(ulOutBufLen);
PIP_ADAPTER_INFO pAdapter;
if (GetAdaptersInfo(pInfo, &ulOutBufLen) == NO_ERROR) {
pAdapter = pInfo;
while (pAdapter) {
dump(L"[SYS] NIC: %S", pAdapter->Description);
pAdapter = pAdapter->Next;
}
callback(diag, kNetProtocolNil, kNetSuccess, param);
}
else {
dump(L"[SYS] Error getting adaper list");
callback(diag, kNetProtocolNil, kNetErrFileNotFound, param);
}
FREE(pInfo);
}
}