2
3
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-14 02:27:40 -04:00

Initial Commit of CyanWorlds.com Engine Open Source Client/Plugin

This commit is contained in:
JWPlatt
2011-03-12 12:34:52 -05:00
commit a20a222fc2
3976 changed files with 1301356 additions and 0 deletions

View File

@ -0,0 +1,25 @@
/*==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/>.
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==*/

View File

@ -0,0 +1,35 @@
/*==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/>.
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/pnNetBase/Private/pnNbAges.h
*
***/
#ifdef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETBASE_PRIVATE_PNNBAGES_H
#error "Header $/Plasma20/Sources/Plasma/NucleusLib/pnNetBase/Private/pnNbAges.h included more than once"
#endif
#define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETBASE_PRIVATE_PNNBAGES_H

View File

@ -0,0 +1,43 @@
/*==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/>.
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/pnNetBase/Private/pnNbAllIncludes.h
*
***/
#ifndef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETBASE_PRIVATE_PNNBALLINCLUDES_H
#define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETBASE_PRIVATE_PNNBALLINCLUDES_H
#include "../pnProduct/pnProduct.h"
#include "pnNbConst.h"
#include "pnNbError.h"
#include "pnNbProtocol.h"
#include "pnNbSrvs.h"
#endif // PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETBASE_PRIVATE_PNNBALLINCLUDES_H

View File

@ -0,0 +1,153 @@
/*==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/>.
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/pnNetBase/Private/pnNbEchoMsgs.h
*
***/
#ifdef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETBASE_PRIVATE_PNNBECHOMSGS_H
#error "Header $/Plasma20/Sources/Plasma/NucleusLib/pnNetBase/Private/pnNbEchoMsgs.h included more than once"
#endif
#define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETBASE_PRIVATE_PNNBECHOMSGS_H
//============================================================================
// Begin Echo server data types
//============================================================================
namespace Echo {
/*****************************************************************************
*
* @@@: Shared data types for echo server/client demo
*
***/
const unsigned kEchoMsgFlagBroadcast = 1<<0;
const unsigned kEchoMsgFlagEchoBack = 1<<1;
enum EEchoNetBufferType {
kEchoNetBufferInvalidType,
kEchoNetBufferMsg,
kNumEchoNetBufferTypes
};
enum EEchoMsgType {
kEchoInvalidMsgType,
kEchoJoinRequestMsg,
kEchoJoinReplyMsg,
kEchoPlayerJoinedMsg,
kEchoPlayerLeftMsg,
kEchoChatMsg,
kEchoGameDataBufferMsg,
kNumEchoMsgTypes
};
COMPILER_ASSERT(kNumEchoMsgTypes < (byte)-1);
//============================================================================
// Begin packed data structures
//============================================================================
#include <pshpack1.h>
struct EchoMsg {
EchoMsg (const EEchoMsgType & type, unsigned flags = 0)
: type((byte)type)
, flags(flags)
{ }
byte type;
dword flags;
};
struct EchoJoinRequestMsg : EchoMsg {
EchoJoinRequestMsg ()
: EchoMsg(kEchoJoinRequestMsg)
{ }
wchar playerName[64];
};
struct EchoJoinReplyMsg : EchoMsg {
EchoJoinReplyMsg ()
: EchoMsg(kEchoJoinReplyMsg)
{ }
dword playerId;
};
struct EchoPlayerJoinedMsg : EchoMsg {
EchoPlayerJoinedMsg ()
: EchoMsg(kEchoPlayerJoinedMsg, kEchoMsgFlagBroadcast)
{ }
dword playerId;
wchar playerName[64];
};
struct EchoPlayerLeftMsg : EchoMsg {
EchoPlayerLeftMsg ()
: EchoMsg(kEchoPlayerLeftMsg, kEchoMsgFlagBroadcast)
{ }
dword playerId;
};
struct EchoChatMsg : EchoMsg {
EchoChatMsg ()
: EchoMsg(kEchoChatMsg, kEchoMsgFlagBroadcast|kEchoMsgFlagEchoBack)
{ }
dword fromPlayerId;
dword msgChars;
wchar msgBuffer[1]; // [msgChars], actually
// no more fields after variable length allocation
};
struct EchoGameDataBufferMsg : EchoMsg {
EchoGameDataBufferMsg ()
: EchoMsg(kEchoGameDataBufferMsg, kEchoMsgFlagBroadcast|kEchoMsgFlagEchoBack)
{ }
dword fromPlayerId;
dword bufferBytes;
byte bufferData[1]; // [bufferBytes], actually
// no more fields after variable length allocation
};
//============================================================================
// End packed data structures
//============================================================================
#include <poppack.h>
//============================================================================
// End Echo server data types
//============================================================================
} using namespace Echo;

View File

@ -0,0 +1,176 @@
/*==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/>.
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/pnNetBase/Private/pnNbError.cpp
*
***/
#include "../Pch.h"
#pragma hdrstop
/*****************************************************************************
*
* Exported functions
*
***/
//============================================================================
// These errors should only be used in debugging. They should not be shown
// in release clients because they are not localized
const wchar * NetErrorToString (ENetError code) {
static wchar * s_errors[] = {
L"Success", // kNetSuccess
L"Internal Error", // kNetErrInternalError
L"No Response From Server", // kNetErrTimeout
L"Invalid Server Data", // kNetErrBadServerData
L"Age Not Found", // kNetErrAgeNotFound
L"Network Connection Failed", // kNetErrConnectFailed
L"Disconnected From Server", // kNetErrDisconnected
L"File Not Found", // kNetErrFileNotFound
L"Old Build", // kNetErrOldBuildId
L"Remote Shutdown", // kNetErrRemoteShutdown
L"Database Timeout", // kNetErrTimeoutOdbc
L"Account Already Exists", // kNetErrAccountAlreadyExists
L"Player Already Exists", // kNetErrPlayerAlreadyExists
L"Account Not Found", // kNetErrAccountNotFound
L"Player Not Found", // kNetErrPlayerNotFound
L"Invalid Parameter", // kNetErrInvalidParameter
L"Name Lookup Failed", // kNetErrNameLookupFailed
L"Logged In Elsewhere", // kNetErrLoggedInElsewhere
L"Vault Node Not Found", // kNetErrVaultNodeNotFound
L"Max Players On Account", // kNetErrMaxPlayersOnAcct
L"Authentication Failed", // kNetErrAuthenticationFailed
L"State Object Not Found", // kNetErrStateObjectNotFound
L"Login Denied", // kNetErrLoginDenied
L"Circular Reference", // kNetErrCircularReference
L"Account Not Activated", // kNetErrAccountNotActivated
L"Key Already Used", // kNetErrKeyAlreadyUsed
L"Key Not Found", // kNetErrKeyNotFound
L"Activation Code Not Found", // kNetErrActivationCodeNotFound
L"Player Name Invalid", // kNetErrPlayerNameInvalid
L"Not Supported", // kNetErrNotSupported
L"Service Forbidden", // kNetErrServiceForbidden
L"Auth Token Too Old", // kNetErrAuthTokenTooOld
L"Must Use GameTap Client", // kNetErrMustUseGameTapClient
L"Too Many Failed Logins", // kNetErrTooManyFailedLogins
L"GameTap: Connection Failed", // kNetErrGameTapConnectionFailed
L"GameTap: Too Many Auth Options", // kNetErrGTTooManyAuthOptions
L"GameTap: Missing Parameter", // kNetErrGTMissingParameter
L"GameTap: Server Error", // kNetErrGTServerError
L"Account has been banned", // kNetErrAccountBanned
L"Account kicked by CCR", // kNetErrKickedByCCR
L"Wrong score type for operation", // kNetErrScoreWrongType
L"Not enough points", // kNetErrScoreNotEnoughPoints
L"Non-fixed score already exists", // kNetErrScoreAlreadyExists
L"No score data found", // kNetErrScoreNoDataFound
L"Invite: Couldn't find player", // kNetErrInviteNoMatchingPlayer
L"Invite: Too many hoods", // kNetErrInviteTooManyHoods
L"Payments not up to date", // kNetErrNeedToPay
L"Server Busy", // kNetErrServerBusy
L"Vault Node Access Violation", // kNetErrVaultNodeAccessViolation
};
COMPILER_ASSERT(arrsize(s_errors) == kNumNetErrors);
if ((unsigned)code >= arrsize(s_errors)) {
if (code == kNetPending)
return L"Pending";
return L"Unknown Error";
}
return s_errors[code];
}
//============================================================================
// These errors should only be used in debugging. They should not be shown
// in release clients because they are not localized
const wchar * NetErrorAsString (ENetError code) {
#define ERROR_STRING(e) L#e
static wchar * s_errors[] = {
ERROR_STRING(kNetSuccess),
ERROR_STRING(kNetErrInternalError),
ERROR_STRING(kNetErrTimeout),
ERROR_STRING(kNetErrBadServerData),
ERROR_STRING(kNetErrAgeNotFound),
ERROR_STRING(kNetErrConnectFailed),
ERROR_STRING(kNetErrDisconnected),
ERROR_STRING(kNetErrFileNotFound),
ERROR_STRING(kNetErrOldBuildId),
ERROR_STRING(kNetErrRemoteShutdown),
ERROR_STRING(kNetErrTimeoutOdbc),
ERROR_STRING(kNetErrAccountAlreadyExists),
ERROR_STRING(kNetErrPlayerAlreadyExists),
ERROR_STRING(kNetErrAccountNotFound),
ERROR_STRING(kNetErrPlayerNotFound),
ERROR_STRING(kNetErrInvalidParameter),
ERROR_STRING(kNetErrNameLookupFailed),
ERROR_STRING(kNetErrLoggedInElsewhere),
ERROR_STRING(kNetErrVaultNodeNotFound),
ERROR_STRING(kNetErrMaxPlayersOnAcct),
ERROR_STRING(kNetErrAuthenticationFailed),
ERROR_STRING(kNetErrStateObjectNotFound),
ERROR_STRING(kNetErrLoginDenied),
ERROR_STRING(kNetErrCircularReference),
ERROR_STRING(kNetErrAccountNotActivated),
ERROR_STRING(kNetErrKeyAlreadyUsed),
ERROR_STRING(kNetErrKeyNotFound),
ERROR_STRING(kNetErrActivationCodeNotFound),
ERROR_STRING(kNetErrPlayerNameInvalid),
ERROR_STRING(kNetErrNotSupported),
ERROR_STRING(kNetErrServiceForbidden),
ERROR_STRING(kNetErrAuthTokenTooOld),
ERROR_STRING(kNetErrMustUseGameTapClient),
ERROR_STRING(kNetErrTooManyFailedLogins),
ERROR_STRING(kNetErrGameTapConnectionFailed),
ERROR_STRING(kNetErrGTTooManyAuthOptions),
ERROR_STRING(kNetErrGTMissingParameter),
ERROR_STRING(kNetErrGTServerError),
ERROR_STRING(kNetErrAccountBanned),
ERROR_STRING(kNetErrKickedByCCR),
ERROR_STRING(kNetErrScoreWrongType),
ERROR_STRING(kNetErrScoreNotEnoughPoints),
ERROR_STRING(kNetErrScoreAlreadyExists),
ERROR_STRING(kNetErrScoreNoDataFound),
ERROR_STRING(kNetErrInviteNoMatchingPlayer),
ERROR_STRING(kNetErrInviteTooManyHoods),
ERROR_STRING(kNetErrNeedToPay),
ERROR_STRING(kNetErrServerBusy),
ERROR_STRING(kNetErrVaultNodeAccessViolation),
};
COMPILER_ASSERT(arrsize(s_errors) == kNumNetErrors);
if ((unsigned)code >= arrsize(s_errors)) {
if (code == kNetPending)
return ERROR_STRING(kNetPending);
return L"ErrUnknown";
}
#undef ERROR_STRING
return s_errors[code];
}

View File

@ -0,0 +1,116 @@
/*==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/>.
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/pnNetBase/Private/pnNbError.h
*
***/
#ifdef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETBASE_PRIVATE_PNNBERROR_H
#error "Header $/Plasma20/Sources/Plasma/NucleusLib/pnNetBase/Private/pnNbError.h included more than once"
#endif
#define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETBASE_PRIVATE_PNNBERROR_H
/*****************************************************************************
*
* Net Error
*
***/
// These codes may not be changed unless ALL servers, clients and databases
// are simultaneously updated; so basically forget it =)
enum ENetError {
// codes <= 0 are not errors
kNetPending = -1,
kNetSuccess = 0,
// codes > 0 are errors
kNetErrInternalError = 1,
kNetErrTimeout = 2,
kNetErrBadServerData = 3,
kNetErrAgeNotFound = 4,
kNetErrConnectFailed = 5,
kNetErrDisconnected = 6,
kNetErrFileNotFound = 7,
kNetErrOldBuildId = 8,
kNetErrRemoteShutdown = 9,
kNetErrTimeoutOdbc = 10,
kNetErrAccountAlreadyExists = 11,
kNetErrPlayerAlreadyExists = 12,
kNetErrAccountNotFound = 13,
kNetErrPlayerNotFound = 14,
kNetErrInvalidParameter = 15,
kNetErrNameLookupFailed = 16,
kNetErrLoggedInElsewhere = 17,
kNetErrVaultNodeNotFound = 18,
kNetErrMaxPlayersOnAcct = 19,
kNetErrAuthenticationFailed = 20,
kNetErrStateObjectNotFound = 21,
kNetErrLoginDenied = 22,
kNetErrCircularReference = 23,
kNetErrAccountNotActivated = 24,
kNetErrKeyAlreadyUsed = 25,
kNetErrKeyNotFound = 26,
kNetErrActivationCodeNotFound = 27,
kNetErrPlayerNameInvalid = 28,
kNetErrNotSupported = 29,
kNetErrServiceForbidden = 30,
kNetErrAuthTokenTooOld = 31,
kNetErrMustUseGameTapClient = 32,
kNetErrTooManyFailedLogins = 33,
kNetErrGameTapConnectionFailed = 34,
kNetErrGTTooManyAuthOptions = 35,
kNetErrGTMissingParameter = 36,
kNetErrGTServerError = 37,
kNetErrAccountBanned = 38,
kNetErrKickedByCCR = 39,
kNetErrScoreWrongType = 40,
kNetErrScoreNotEnoughPoints = 41,
kNetErrScoreAlreadyExists = 42,
kNetErrScoreNoDataFound = 43,
kNetErrInviteNoMatchingPlayer = 44,
kNetErrInviteTooManyHoods = 45,
kNetErrNeedToPay = 46,
kNetErrServerBusy = 47,
kNetErrVaultNodeAccessViolation = 48,
// Be sure to add strings for additional error codes in pnNbError.cpp
// (don't worry, the compiler will tell you if one is missing ;)
kNumNetErrors,
// Net messages require ENetError to be sizeof(dword)
kNetErrorForceDword = (dword) -1
};
COMPILER_ASSERT_HEADER(pnNbError, sizeof(ENetError) == sizeof(dword));
#define IS_NET_ERROR(a) (((int)(a)) > kNetSuccess)
#define IS_NET_SUCCESS(a) (((int)(a)) == kNetSuccess)
const wchar * NetErrorToString (ENetError code); // user-friendly string
const wchar * NetErrorAsString (ENetError code); // string version of enum identifier

View File

@ -0,0 +1,76 @@
/*==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/>.
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/pnNetBase/Private/pnNbProtocol.cpp
*
***/
#include "../Pch.h"
#pragma hdrstop
/*****************************************************************************
*
* Exports
*
***/
//============================================================================
const wchar * NetProtocolToString (ENetProtocol protocol) {
#define PROTOCOL_STRING(p) { p, L#p }
static struct { ENetProtocol protocol; const wchar *name; } s_protocols[] = {
PROTOCOL_STRING(kNetProtocolNil),
// For test applications
PROTOCOL_STRING(kNetProtocolDebug),
// Client connections
{ kNetProtocolCli2Csr, L"GateKeeper Server" },
{ kNetProtocolCli2Csr, L"Csr Server" },
{ kNetProtocolCli2Auth, L"Auth Server" },
{ kNetProtocolCli2Game, L"Game Server" },
{ kNetProtocolCli2File, L"File Server" },
PROTOCOL_STRING(kNetProtocolCli2Unused_01),
// Server connections
PROTOCOL_STRING(kNetProtocolSrvConn),
PROTOCOL_STRING(kNetProtocolSrv2Mcp),
PROTOCOL_STRING(kNetProtocolSrv2Vault),
PROTOCOL_STRING(kNetProtocolSrv2Db),
PROTOCOL_STRING(kNetProtocolSrv2State),
PROTOCOL_STRING(kNetProtocolSrv2Log),
PROTOCOL_STRING(kNetProtocolSrv2Score),
};
#undef PROTOCOL_STRING
for (unsigned i = 0; i < arrsize(s_protocols); ++i)
if (s_protocols[i].protocol == protocol)
return s_protocols[i].name;
return L"Unknown protocol id";
}

View File

@ -0,0 +1,76 @@
/*==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/>.
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/pnNetBase/Private/pnNbProtocol.h
*
***/
#ifdef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETBASE_PRIVATE_PNNBPROTOCOL_H
#error "Header $/Plasma20/Sources/Plasma/NucleusLib/pnNetBase/Private/pnNbProtocol.h included more than once"
#endif
#define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETBASE_PRIVATE_PNNBPROTOCOL_H
/*****************************************************************************
*
* Net protocols
*
***/
const unsigned kNetProtocolServerBit = 0x80;
// These codes may not be changed unless ALL servers and clients are
// simultaneously replaced; so basically forget it =)
enum ENetProtocol {
kNetProtocolNil = 0,
// For test applications
kNetProtocolDebug = 1,
// Client connections
kNetProtocolCli2GateKeeper = 2,
kNetProtocolCli2Csr = 3,
kNetProtocolCli2Auth = 4,
kNetProtocolCli2Game = 5,
kNetProtocolCli2File = 6,
kNetProtocolCli2Unused_01 = 7,
// Server connections
kNetProtocolSrvConn = 0 | kNetProtocolServerBit,
kNetProtocolSrv2Mcp = 1 | kNetProtocolServerBit,
kNetProtocolSrv2Vault = 2 | kNetProtocolServerBit,
kNetProtocolSrv2Db = 3 | kNetProtocolServerBit,
kNetProtocolSrv2State = 4 | kNetProtocolServerBit,
kNetProtocolSrv2Log = 5 | kNetProtocolServerBit,
kNetProtocolSrv2Score = 6 | kNetProtocolServerBit,
};
// NOTE: When adding a new net protocol, be sure to update
// NetProtocolToString as well. Unfortunately, the compiler
// cannot enforce this since the protocol values are not
// numerically sequential.
const wchar * NetProtocolToString (ENetProtocol protocol);

View File

@ -0,0 +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/>.
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/pnNetBase/Private/pnNbSrvs.cpp
*
***/
#include "../Pch.h"
#pragma hdrstop
#ifndef BUILD_TYPE
# error "pnProduct not included"
#endif
/*****************************************************************************
*
* Local data
*
***/
//============================================================================
// Auth
//============================================================================
static const wchar * s_authAddrs[] = {
#if BUILD_TYPE == BUILD_TYPE_DEV
L"shard"
#elif BUILD_TYPE == BUILD_TYPE_QA
L"marrim"
#elif BUILD_TYPE == BUILD_TYPE_TEST
L"test-auth.urulive.com"
#elif BUILD_TYPE == BUILD_TYPE_BETA
L"beta-auth.urulive.com"
#elif BUILD_TYPE == BUILD_TYPE_LIVE
L"184.73.198.22" //L"auth.urulive.com"
#else
# error "Unknown build type"
#endif
};
static wchar s_authAddrCmdLine[64];
static const wchar * s_authAddrsOverride[] = {
s_authAddrCmdLine
};
//============================================================================
// File
//============================================================================
static const wchar * s_fileAddrs[] = {
#if BUILD_TYPE == BUILD_TYPE_DEV
L"shard"
#elif BUILD_TYPE == BUILD_TYPE_QA
L"marrim"
#elif BUILD_TYPE == BUILD_TYPE_TEST
L"test-file.urulive.com"
#elif BUILD_TYPE == BUILD_TYPE_BETA
L"beta-file.urulive.com"
#elif BUILD_TYPE == BUILD_TYPE_LIVE
L"67.202.54.141" //unused
#else
# error "Unknown build type"
#endif
};
static wchar s_fileAddrCmdLine[64];
static const wchar * s_fileAddrsOverride[] = {
s_fileAddrCmdLine
};
//============================================================================
// Csr
//============================================================================
static const wchar * s_csrAddrs[] = {
#if BUILD_TYPE == BUILD_TYPE_DEV
L"localhost"
#elif BUILD_TYPE == BUILD_TYPE_QA
L"localhost"
#elif BUILD_TYPE == BUILD_TYPE_TEST
L"localhost"
#elif BUILD_TYPE == BUILD_TYPE_BETA
L"beta-csr.urulive.com"
#elif BUILD_TYPE == BUILD_TYPE_LIVE
L"localhost"
#else
# error "Unknown build type"
#endif
};
static wchar s_csrAddrCmdLine[64];
static const wchar * s_csrAddrsOverride[] = {
s_csrAddrCmdLine
};
//============================================================================
// GateKeeper
//============================================================================
static const wchar * s_gateKeeperAddrs[] = {
#if BUILD_TYPE == BUILD_TYPE_DEV
L"localhost"
#elif BUILD_TYPE == BUILD_TYPE_QA
L"localhost"
#elif BUILD_TYPE == BUILD_TYPE_TEST
L"localhost"
#elif BUILD_TYPE == BUILD_TYPE_BETA
L"beta-csr.urulive.com"
#elif BUILD_TYPE == BUILD_TYPE_LIVE
L"184.73.198.22"
#else
# error "Unknown build type"
#endif
};
static wchar s_gateKeeperAddrCmdLine[64];
static const wchar * s_gateKeeperAddrsOverride[] = {
s_gateKeeperAddrCmdLine
};
/*****************************************************************************
*
* Exports
*
***/
//============================================================================
// Auth
//============================================================================
unsigned GetAuthSrvHostnames (const wchar *** addrs) {
if (s_authAddrCmdLine[0]) {
*addrs = s_authAddrsOverride;
return arrsize(s_authAddrsOverride);
}
else {
*addrs = s_authAddrs;
return arrsize(s_authAddrs);
}
}
//============================================================================
void SetAuthSrvHostname (const wchar addr[]) {
StrCopy(s_authAddrCmdLine, addr, arrsize(s_authAddrCmdLine));
}
//============================================================================
bool AuthSrvHostnameOverride () {
return s_authAddrCmdLine[0];
}
//============================================================================
// File
//============================================================================
unsigned GetFileSrvHostnames (const wchar *** addrs) {
if (s_fileAddrCmdLine[0]) {
*addrs = s_fileAddrsOverride;
return arrsize(s_fileAddrsOverride);
}
else {
*addrs = s_fileAddrs;
return arrsize(s_fileAddrs);
}
}
//============================================================================
void SetFileSrvHostname (const wchar addr[]) {
StrCopy(s_fileAddrCmdLine, addr, arrsize(s_fileAddrCmdLine));
}
//============================================================================
bool FileSrvHostnameOverride () {
return s_fileAddrCmdLine[0];
}
//============================================================================
// Csr
//============================================================================
unsigned GetCsrSrvHostnames (const wchar *** addrs) {
if (s_csrAddrCmdLine[0]) {
*addrs = s_csrAddrsOverride;
return arrsize(s_csrAddrsOverride);
}
else {
*addrs = s_csrAddrs;
return arrsize(s_csrAddrs);
}
}
//============================================================================
void SetCsrSrvHostname (const wchar addr[]) {
StrCopy(s_csrAddrCmdLine, addr, arrsize(s_csrAddrCmdLine));
}
//============================================================================
bool CsrSrvHostnameOverride () {
return s_csrAddrCmdLine[0];
}
//============================================================================
// GateKeeper
//============================================================================
unsigned GetGateKeeperSrvHostnames (const wchar *** addrs) {
if (s_gateKeeperAddrCmdLine[0]) {
*addrs = s_gateKeeperAddrsOverride;
return arrsize(s_gateKeeperAddrsOverride);
}
else {
*addrs = s_gateKeeperAddrs;
return arrsize(s_gateKeeperAddrs);
}
}
//============================================================================
void SetGateKeeperSrvHostname (const wchar addr[]) {
StrCopy(s_gateKeeperAddrCmdLine, addr, arrsize(s_gateKeeperAddrCmdLine));
}
//============================================================================
bool GateKeeperSrvHostnameOverride () {
return s_gateKeeperAddrCmdLine[0];
}

View File

@ -0,0 +1,90 @@
/*==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/>.
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/pnNetBase/Private/pnNbSrvs.h
*
***/
#ifdef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETBASE_PRIVATE_PNNBSRVS_H
#error "Header $/Plasma20/Sources/Plasma/NucleusLib/pnNetBase/Private/pnNbSrvs.h included more than once"
#endif
#define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETBASE_PRIVATE_PNNBSRVS_H
/*****************************************************************************
*
* Server types
*
***/
// These codes may not be changed unless ALL servers and clients are
// simultaneously replaced; so basically forget it =)
enum ESrvType {
kSrvTypeNone = 0,
kSrvTypeClient = 1,
kSrvTypeAuth = 2,
kSrvTypeGame = 3,
kSrvTypeVault = 4,
kSrvTypeDb = 5,
kSrvTypeMcp = 6,
kSrvTypeState = 7,
kSrvTypeFile = 8,
kSrvTypeLog = 9,
kSrvTypeDll = 10,
kSrvTypeScore = 11,
kSrvTypeCsr = 12,
kSrvTypeGateKeeper = 13,
kNumSrvTypes,
// Enforce network message field size
kNetSrvForceDword = (unsigned)-1
};
/*****************************************************************************
*
* Front-end server hostnames
*
***/
unsigned GetAuthSrvHostnames (const wchar *** addrs); // returns addrCount
void SetAuthSrvHostname (const wchar addr[]);
bool AuthSrvHostnameOverride ();
unsigned GetFileSrvHostnames (const wchar *** addrs); // returns addrCount
void SetFileSrvHostname (const wchar addr[]);
bool FileSrvHostnameOverride ();
unsigned GetCsrSrvHostnames (const wchar *** addrs); // returns addrCount
void SetCsrSrvHostname (const wchar addr[]);
bool CsrSrvHostnameOverride ();
unsigned GetGateKeeperSrvHostnames (const wchar *** addrs); // returns addrCount
void SetGateKeeperSrvHostname (const wchar addr[]);
bool GateKeeperSrvHostnameOverride ();