2
3
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-13 18:17:49 -04:00

Fix line endings and tabs

This commit is contained in:
Branan Purvine-Riley
2011-04-11 16:27:55 -07:00
parent d4250e19b5
commit 908aaeb6f6
2738 changed files with 702562 additions and 702562 deletions

View File

@ -1,106 +1,106 @@
/*==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/pnNetProtocol/Private/Protocols/Cli2Csr/pnNpCli2Csr.cpp
*
***/
#define USES_PROTOCOL_CLI2CSR
#include "../../../Pch.h"
#pragma hdrstop
namespace Cli2Csr {
/*****************************************************************************
*
* Cli2Csr message field definitions
*
***/
static const NetMsgField kPingRequestFields[] = {
kNetMsgFieldTransId, // transId
kNetMsgFieldTimeMs, // pingTimeMs
NET_MSG_FIELD_VAR_COUNT(1, 64 * 1024), // payloadBytes
NET_MSG_FIELD_VAR_PTR(), // payload
};
static const NetMsgField kRegisterRequestFields[] = {
kNetMsgFieldTransId, // transId
};
static const NetMsgField kLoginRequestFields[] = {
kNetMsgFieldTransId, // transId
NET_MSG_FIELD_DWORD(), // clientChallenge
kNetMsgFieldAccountName, // csrName
kNetMsgFieldShaDigest, // challenge
};
/*****************************************************************************
*
* Csr2Cli message field definitions
*
***/
static const NetMsgField kPingReplyFields[] = {
kNetMsgFieldTransId, // transId
kNetMsgFieldTimeMs, // pingTimeMs
NET_MSG_FIELD_VAR_COUNT(1, 64 * 1024), // payloadBytes
NET_MSG_FIELD_VAR_PTR(), // payload
};
static const NetMsgField kRegisterReplyFields[] = {
kNetMsgFieldTransId, // transId
NET_MSG_FIELD_DWORD(), // serverChallenge
NET_MSG_FIELD_DWORD(), // latestBuildId
};
static const NetMsgField kLoginReplyFields[] = {
kNetMsgFieldTransId, // transId
kNetMsgFieldENetError, // result
kNetMsgFieldUuid, // csrId
NET_MSG_FIELD_DWORD(), // csrFlags
};
} using namespace Cli2Csr;
/*****************************************************************************
*
* Exports
*
***/
const NetMsg kNetMsg_Cli2Csr_PingRequest = NET_MSG(kCli2Csr_PingRequest, kPingRequestFields);
const NetMsg kNetMsg_Cli2Csr_RegisterRequest = NET_MSG(kCli2Csr_RegisterRequest, kRegisterRequestFields);
const NetMsg kNetMsg_Cli2Csr_LoginRequest = NET_MSG(kCli2Csr_LoginRequest, kLoginRequestFields);
const NetMsg kNetMsg_Csr2Cli_PingReply = NET_MSG(kCsr2Cli_PingReply, kPingReplyFields);
const NetMsg kNetMsg_Csr2Cli_RegisterReply = NET_MSG(kCsr2Cli_RegisterReply, kRegisterReplyFields);
const NetMsg kNetMsg_Csr2Cli_LoginReply = NET_MSG(kCsr2Cli_LoginReply, kLoginReplyFields);
/*==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/pnNetProtocol/Private/Protocols/Cli2Csr/pnNpCli2Csr.cpp
*
***/
#define USES_PROTOCOL_CLI2CSR
#include "../../../Pch.h"
#pragma hdrstop
namespace Cli2Csr {
/*****************************************************************************
*
* Cli2Csr message field definitions
*
***/
static const NetMsgField kPingRequestFields[] = {
kNetMsgFieldTransId, // transId
kNetMsgFieldTimeMs, // pingTimeMs
NET_MSG_FIELD_VAR_COUNT(1, 64 * 1024), // payloadBytes
NET_MSG_FIELD_VAR_PTR(), // payload
};
static const NetMsgField kRegisterRequestFields[] = {
kNetMsgFieldTransId, // transId
};
static const NetMsgField kLoginRequestFields[] = {
kNetMsgFieldTransId, // transId
NET_MSG_FIELD_DWORD(), // clientChallenge
kNetMsgFieldAccountName, // csrName
kNetMsgFieldShaDigest, // challenge
};
/*****************************************************************************
*
* Csr2Cli message field definitions
*
***/
static const NetMsgField kPingReplyFields[] = {
kNetMsgFieldTransId, // transId
kNetMsgFieldTimeMs, // pingTimeMs
NET_MSG_FIELD_VAR_COUNT(1, 64 * 1024), // payloadBytes
NET_MSG_FIELD_VAR_PTR(), // payload
};
static const NetMsgField kRegisterReplyFields[] = {
kNetMsgFieldTransId, // transId
NET_MSG_FIELD_DWORD(), // serverChallenge
NET_MSG_FIELD_DWORD(), // latestBuildId
};
static const NetMsgField kLoginReplyFields[] = {
kNetMsgFieldTransId, // transId
kNetMsgFieldENetError, // result
kNetMsgFieldUuid, // csrId
NET_MSG_FIELD_DWORD(), // csrFlags
};
} using namespace Cli2Csr;
/*****************************************************************************
*
* Exports
*
***/
const NetMsg kNetMsg_Cli2Csr_PingRequest = NET_MSG(kCli2Csr_PingRequest, kPingRequestFields);
const NetMsg kNetMsg_Cli2Csr_RegisterRequest = NET_MSG(kCli2Csr_RegisterRequest, kRegisterRequestFields);
const NetMsg kNetMsg_Cli2Csr_LoginRequest = NET_MSG(kCli2Csr_LoginRequest, kLoginRequestFields);
const NetMsg kNetMsg_Csr2Cli_PingReply = NET_MSG(kCsr2Cli_PingReply, kPingReplyFields);
const NetMsg kNetMsg_Csr2Cli_RegisterReply = NET_MSG(kCsr2Cli_RegisterReply, kRegisterReplyFields);
const NetMsg kNetMsg_Csr2Cli_LoginReply = NET_MSG(kCsr2Cli_LoginReply, kLoginReplyFields);

View File

@ -1,162 +1,162 @@
/*==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/pnNetProtocol/Private/Protocols/Cli2Csr/pnNpCli2Csr.h
*
***/
#ifdef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETPROTOCOL_PRIVATE_PROTOCOLS_CLI2CSR_PNNPCLI2CSR_H
#error "Header $/Plasma20/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Cli2Csr/pnNpCli2Csr.h included more than once"
#endif
#define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETPROTOCOL_PRIVATE_PROTOCOLS_CLI2CSR_PNNPCLI2CSR_H
/*****************************************************************************
*
* kNetProtocolCli2Csr message ids
*
***/
// Because SrvCsr must remain backward compatible with all client builds,
// the following enum values may never change under any circumstances.
//============================================================================
// Cli2Csr
enum {
// Misc
kCli2Csr_PingRequest = 0,
// Encrypt
kCli2Csr_RegisterRequest = 1,
// Login
kCli2Csr_LoginRequest = 2,
// Patch
kCli2Csr_PatchRequest = 3,
kNumCli2CsrMessages
};
COMPILER_ASSERT_HEADER(Cli2Scr, kNumCli2CsrMessages <= (word)-1);
//============================================================================
// Csr2Cli
enum {
// Misc
kCsr2Cli_PingReply = 0,
// Encrypt
kCsr2Cli_RegisterReply = 1,
// Login
kCsr2Cli_LoginReply = 2,
// Patch
kCli2Csr_PatchReply = 3,
kNumCsr2CliMessages
};
COMPILER_ASSERT_HEADER(Cli2Scr, kNumCsr2CliMessages <= (word)-1);
/*****************************************************************************
*
* Networked structures
*
***/
#include <PshPack1.h>
//============================================================================
// Connect packet
struct Cli2Csr_ConnData {
dword dataBytes;
};
struct Cli2Csr_Connect {
AsyncSocketConnectPacket hdr;
Cli2Csr_ConnData data;
};
//============================================================================
// Message header
struct Cli2Csr_MsgHeader {
dword messageId;
dword transId;
};
//============================================================================
// Cli --> Csr message structures
// PingRequest
extern const NetMsg kNetMsg_Cli2Csr_PingRequest;
struct Cli2Csr_PingRequest : Cli2Csr_MsgHeader {
dword pingTimeMs;
dword payloadBytes;
byte payload[1]; // [payloadBytes]
};
// RegisterRequest
extern const NetMsg kNetMsg_Cli2Csr_RegisterRequest;
struct Cli2Csr_RegisterRequest : Cli2Csr_MsgHeader {
};
// LoginRequest
extern const NetMsg kNetMsg_Cli2Csr_LoginRequest;
struct Cli2Csr_LoginRequest : Cli2Csr_MsgHeader {
dword clientChallenge;
wchar csrName[kMaxAccountNameLength];
ShaDigest challengeHash;
};
//============================================================================
// Csr --> Cli message structures
// PingReply
extern const NetMsg kNetMsg_Csr2Cli_PingReply;
struct Csr2Cli_PingReply : Cli2Csr_MsgHeader {
dword pingTimeMs;
dword payloadBytes;
byte payload[1]; // [payloadBytes]
};
// RegisterReply
extern const NetMsg kNetMsg_Csr2Cli_RegisterReply;
struct Csr2Cli_RegisterReply : Cli2Csr_MsgHeader {
dword serverChallenge;
dword csrBuildId; // buildId of the latest csr client
};
// LoginReply
extern const NetMsg kNetMsg_Csr2Cli_LoginReply;
struct Csr2Cli_LoginReply : Cli2Csr_MsgHeader {
ENetError result;
Uuid csrId;
dword csrFlags;
};
#include <PopPack.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/>.
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/pnNetProtocol/Private/Protocols/Cli2Csr/pnNpCli2Csr.h
*
***/
#ifdef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETPROTOCOL_PRIVATE_PROTOCOLS_CLI2CSR_PNNPCLI2CSR_H
#error "Header $/Plasma20/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Cli2Csr/pnNpCli2Csr.h included more than once"
#endif
#define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETPROTOCOL_PRIVATE_PROTOCOLS_CLI2CSR_PNNPCLI2CSR_H
/*****************************************************************************
*
* kNetProtocolCli2Csr message ids
*
***/
// Because SrvCsr must remain backward compatible with all client builds,
// the following enum values may never change under any circumstances.
//============================================================================
// Cli2Csr
enum {
// Misc
kCli2Csr_PingRequest = 0,
// Encrypt
kCli2Csr_RegisterRequest = 1,
// Login
kCli2Csr_LoginRequest = 2,
// Patch
kCli2Csr_PatchRequest = 3,
kNumCli2CsrMessages
};
COMPILER_ASSERT_HEADER(Cli2Scr, kNumCli2CsrMessages <= (word)-1);
//============================================================================
// Csr2Cli
enum {
// Misc
kCsr2Cli_PingReply = 0,
// Encrypt
kCsr2Cli_RegisterReply = 1,
// Login
kCsr2Cli_LoginReply = 2,
// Patch
kCli2Csr_PatchReply = 3,
kNumCsr2CliMessages
};
COMPILER_ASSERT_HEADER(Cli2Scr, kNumCsr2CliMessages <= (word)-1);
/*****************************************************************************
*
* Networked structures
*
***/
#include <PshPack1.h>
//============================================================================
// Connect packet
struct Cli2Csr_ConnData {
dword dataBytes;
};
struct Cli2Csr_Connect {
AsyncSocketConnectPacket hdr;
Cli2Csr_ConnData data;
};
//============================================================================
// Message header
struct Cli2Csr_MsgHeader {
dword messageId;
dword transId;
};
//============================================================================
// Cli --> Csr message structures
// PingRequest
extern const NetMsg kNetMsg_Cli2Csr_PingRequest;
struct Cli2Csr_PingRequest : Cli2Csr_MsgHeader {
dword pingTimeMs;
dword payloadBytes;
byte payload[1]; // [payloadBytes]
};
// RegisterRequest
extern const NetMsg kNetMsg_Cli2Csr_RegisterRequest;
struct Cli2Csr_RegisterRequest : Cli2Csr_MsgHeader {
};
// LoginRequest
extern const NetMsg kNetMsg_Cli2Csr_LoginRequest;
struct Cli2Csr_LoginRequest : Cli2Csr_MsgHeader {
dword clientChallenge;
wchar csrName[kMaxAccountNameLength];
ShaDigest challengeHash;
};
//============================================================================
// Csr --> Cli message structures
// PingReply
extern const NetMsg kNetMsg_Csr2Cli_PingReply;
struct Csr2Cli_PingReply : Cli2Csr_MsgHeader {
dword pingTimeMs;
dword payloadBytes;
byte payload[1]; // [payloadBytes]
};
// RegisterReply
extern const NetMsg kNetMsg_Csr2Cli_RegisterReply;
struct Csr2Cli_RegisterReply : Cli2Csr_MsgHeader {
dword serverChallenge;
dword csrBuildId; // buildId of the latest csr client
};
// LoginReply
extern const NetMsg kNetMsg_Csr2Cli_LoginReply;
struct Csr2Cli_LoginReply : Cli2Csr_MsgHeader {
ENetError result;
Uuid csrId;
dword csrFlags;
};
#include <PopPack.h>

View File

@ -1,34 +1,34 @@
/*==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/pnNetProtocol/Private/Protocols/Cli2File/pnNpCli2File.cpp
*
***/
#define USES_PROTOCOL_CLI2FILE
#include "../../../Pch.h"
#pragma hdrstop
/*==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/pnNetProtocol/Private/Protocols/Cli2File/pnNpCli2File.cpp
*
***/
#define USES_PROTOCOL_CLI2FILE
#include "../../../Pch.h"
#pragma hdrstop

View File

@ -1,195 +1,195 @@
/*==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/pnNetProtocol/Private/Protocols/Cli2File/pnNpCli2File.h
*
***/
#ifdef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETPROTOCOL_PRIVATE_PROTOCOLS_CLI2FILE_PNNPCLI2FILE_H
#error "Header $/Plasma20/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Cli2File/pnNpCli2File.h included more than once"
#endif
#define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETPROTOCOL_PRIVATE_PROTOCOLS_CLI2FILE_PNNPCLI2FILE_H
// Because SrvFile must remain backward compatible with all client builds,
// the following enum values may never change under any circumstances.
// kNetProtocolCli2File messages
enum {
// Global
kCli2File_PingRequest = 0,
// File server-related
kCli2File_BuildIdRequest = 10,
// 11 through 19 skipped
// Cache-related
kCli2File_ManifestRequest = 20,
kCli2File_FileDownloadRequest = 21,
kCli2File_ManifestEntryAck = 22,
kCli2File_FileDownloadChunkAck = 23,
// 24 through 29 skipped
kCli2File_UNUSED_1 = 30,
};
enum {
// Global
kFile2Cli_PingReply = 0,
// File server-related
kFile2Cli_BuildIdReply = 10,
kFile2Cli_BuildIdUpdate = 11,
// 12 through 19 skipped
// Cache-related
kFile2Cli_ManifestReply = 20,
kFile2Cli_FileDownloadReply = 21,
// 22 through 29 skipped
kFile2Cli_UNUSED_1 = 30,
};
// we have a constant build id so all clients can connect to us, no matter what version
static const unsigned kFileSrvBuildId = 0;
//============================================================================
// BEGIN PACKED DATA STRUCTURES
//============================================================================
#include <PshPack1.h>
/*****************************************************************************
*
* Cli2File connect packet
*
***/
struct Cli2File_ConnData {
dword dataBytes;
dword buildId;
unsigned serverType;
};
struct Cli2File_Connect {
AsyncSocketConnectPacket hdr;
Cli2File_ConnData data;
};
struct Cli2File_MsgHeader {
dword messageBytes;
dword messageId;
};
/*****************************************************************************
*
* Cli2File message structures
*
***/
// PingRequest
struct Cli2File_PingRequest : Cli2File_MsgHeader {
dword pingTimeMs;
};
// BuildIdRequest
struct Cli2File_BuildIdRequest : Cli2File_MsgHeader {
dword transId;
};
// ManifestRequest
struct Cli2File_ManifestRequest : Cli2File_MsgHeader {
dword transId;
wchar group[MAX_PATH];
unsigned buildId; // 0 = newest
};
struct Cli2File_ManifestEntryAck : Cli2File_MsgHeader {
dword transId;
dword readerId;
};
// FileDownloadRequest
struct Cli2File_FileDownloadRequest : Cli2File_MsgHeader {
dword transId;
wchar filename[MAX_PATH];
unsigned buildId; // 0 = newest
};
struct Cli2File_FileDownloadChunkAck : Cli2File_MsgHeader {
dword transId;
dword readerId;
};
/*****************************************************************************
*
* File2Cli message structures
*
***/
// PingReply
struct File2Cli_PingReply : Cli2File_MsgHeader {
dword pingTimeMs;
};
// BuildIdReply
struct File2Cli_BuildIdReply : Cli2File_MsgHeader {
dword transId;
ENetError result;
unsigned buildId;
};
// BuildIdUpdate
struct File2Cli_BuildIdUpdate : Cli2File_MsgHeader {
unsigned buildId;
};
// ManifestReply
struct File2Cli_ManifestReply : Cli2File_MsgHeader {
dword transId;
ENetError result;
dword readerId;
dword numFiles; // total number of files
dword wcharCount; // size of the buffer
wchar manifestData[1]; // manifestData[wcharCount], actually
};
// FileDownloadReply
struct File2Cli_FileDownloadReply : Cli2File_MsgHeader {
dword transId;
ENetError result;
dword readerId;
dword totalFileSize;
dword byteCount;
byte fileData[1]; // fileData[byteCount], actually
};
//============================================================================
// END PACKED DATA STRUCTURES
//============================================================================
#include <PopPack.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/>.
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/pnNetProtocol/Private/Protocols/Cli2File/pnNpCli2File.h
*
***/
#ifdef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETPROTOCOL_PRIVATE_PROTOCOLS_CLI2FILE_PNNPCLI2FILE_H
#error "Header $/Plasma20/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Cli2File/pnNpCli2File.h included more than once"
#endif
#define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETPROTOCOL_PRIVATE_PROTOCOLS_CLI2FILE_PNNPCLI2FILE_H
// Because SrvFile must remain backward compatible with all client builds,
// the following enum values may never change under any circumstances.
// kNetProtocolCli2File messages
enum {
// Global
kCli2File_PingRequest = 0,
// File server-related
kCli2File_BuildIdRequest = 10,
// 11 through 19 skipped
// Cache-related
kCli2File_ManifestRequest = 20,
kCli2File_FileDownloadRequest = 21,
kCli2File_ManifestEntryAck = 22,
kCli2File_FileDownloadChunkAck = 23,
// 24 through 29 skipped
kCli2File_UNUSED_1 = 30,
};
enum {
// Global
kFile2Cli_PingReply = 0,
// File server-related
kFile2Cli_BuildIdReply = 10,
kFile2Cli_BuildIdUpdate = 11,
// 12 through 19 skipped
// Cache-related
kFile2Cli_ManifestReply = 20,
kFile2Cli_FileDownloadReply = 21,
// 22 through 29 skipped
kFile2Cli_UNUSED_1 = 30,
};
// we have a constant build id so all clients can connect to us, no matter what version
static const unsigned kFileSrvBuildId = 0;
//============================================================================
// BEGIN PACKED DATA STRUCTURES
//============================================================================
#include <PshPack1.h>
/*****************************************************************************
*
* Cli2File connect packet
*
***/
struct Cli2File_ConnData {
dword dataBytes;
dword buildId;
unsigned serverType;
};
struct Cli2File_Connect {
AsyncSocketConnectPacket hdr;
Cli2File_ConnData data;
};
struct Cli2File_MsgHeader {
dword messageBytes;
dword messageId;
};
/*****************************************************************************
*
* Cli2File message structures
*
***/
// PingRequest
struct Cli2File_PingRequest : Cli2File_MsgHeader {
dword pingTimeMs;
};
// BuildIdRequest
struct Cli2File_BuildIdRequest : Cli2File_MsgHeader {
dword transId;
};
// ManifestRequest
struct Cli2File_ManifestRequest : Cli2File_MsgHeader {
dword transId;
wchar group[MAX_PATH];
unsigned buildId; // 0 = newest
};
struct Cli2File_ManifestEntryAck : Cli2File_MsgHeader {
dword transId;
dword readerId;
};
// FileDownloadRequest
struct Cli2File_FileDownloadRequest : Cli2File_MsgHeader {
dword transId;
wchar filename[MAX_PATH];
unsigned buildId; // 0 = newest
};
struct Cli2File_FileDownloadChunkAck : Cli2File_MsgHeader {
dword transId;
dword readerId;
};
/*****************************************************************************
*
* File2Cli message structures
*
***/
// PingReply
struct File2Cli_PingReply : Cli2File_MsgHeader {
dword pingTimeMs;
};
// BuildIdReply
struct File2Cli_BuildIdReply : Cli2File_MsgHeader {
dword transId;
ENetError result;
unsigned buildId;
};
// BuildIdUpdate
struct File2Cli_BuildIdUpdate : Cli2File_MsgHeader {
unsigned buildId;
};
// ManifestReply
struct File2Cli_ManifestReply : Cli2File_MsgHeader {
dword transId;
ENetError result;
dword readerId;
dword numFiles; // total number of files
dword wcharCount; // size of the buffer
wchar manifestData[1]; // manifestData[wcharCount], actually
};
// FileDownloadReply
struct File2Cli_FileDownloadReply : Cli2File_MsgHeader {
dword transId;
ENetError result;
dword readerId;
dword totalFileSize;
dword byteCount;
byte fileData[1]; // fileData[byteCount], actually
};
//============================================================================
// END PACKED DATA STRUCTURES
//============================================================================
#include <PopPack.h>

View File

@ -1,101 +1,101 @@
/*==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/pnNetProtocol/Private/Protocols/Cli2Game/pnNpCli2Game.cpp
*
***/
#define USES_PROTOCOL_CLI2GAME
#include "../../../Pch.h"
#pragma hdrstop
namespace Cli2Game {
/*****************************************************************************
*
* Cli2Game message definitions
*
***/
static const NetMsgField kPingRequestFields[] = {
kNetMsgFieldTimeMs, // pingTimeMs
};
static const NetMsgField kJoinAgeRequestFields[] = {
kNetMsgFieldTransId, // transId
NET_MSG_FIELD_DWORD(), // ageMcpId
kNetMsgFieldUuid, // accountUuid
NET_MSG_FIELD_DWORD(), // playerInt
};
static const NetMsgField kPropagateBufferFields[] = {
NET_MSG_FIELD_DWORD(), // type
NET_MSG_FIELD_VAR_COUNT(1, 1024 * 1024), // bytes
NET_MSG_FIELD_VAR_PTR(), // buffer
};
static const NetMsgField kGameMgrMsgFields[] = {
NET_MSG_FIELD_VAR_COUNT(1, 1024 * 1024), // bytes
NET_MSG_FIELD_VAR_PTR(), // buffer
};
/*****************************************************************************
*
* Game2Cli message fields
*
***/
static const NetMsgField kPingReplyFields[] = {
kNetMsgFieldTimeMs, // pingTimeMs
};
static const NetMsgField kJoinAgeReplyFields[] = {
kNetMsgFieldTransId, // transId
kNetMsgFieldENetError, // result
};
} using namespace Cli2Game;
/*****************************************************************************
*
* Exported data
*
***/
// Cli2Game
const NetMsg kNetMsg_Cli2Game_PingRequest = NET_MSG(kCli2Game_PingRequest, kPingRequestFields);
const NetMsg kNetMsg_Cli2Game_JoinAgeRequest = NET_MSG(kCli2Game_JoinAgeRequest, kJoinAgeRequestFields);
const NetMsg kNetMsg_Cli2Game_PropagateBuffer = NET_MSG(kCli2Game_PropagateBuffer, kPropagateBufferFields);
const NetMsg kNetMsg_Cli2Game_GameMgrMsg = NET_MSG(kCli2Game_GameMgrMsg, kGameMgrMsgFields);
// Game2Cli
const NetMsg kNetMsg_Game2Cli_PingReply = NET_MSG(kGame2Cli_PingReply, kPingReplyFields);
const NetMsg kNetMsg_Game2Cli_JoinAgeReply = NET_MSG(kGame2Cli_JoinAgeReply, kJoinAgeReplyFields);
const NetMsg kNetMsg_Game2Cli_PropagateBuffer = NET_MSG(kGame2Cli_PropagateBuffer, kPropagateBufferFields);
const NetMsg kNetMsg_Game2Cli_GameMgrMsg = NET_MSG(kGame2Cli_GameMgrMsg, kGameMgrMsgFields);
/*==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/pnNetProtocol/Private/Protocols/Cli2Game/pnNpCli2Game.cpp
*
***/
#define USES_PROTOCOL_CLI2GAME
#include "../../../Pch.h"
#pragma hdrstop
namespace Cli2Game {
/*****************************************************************************
*
* Cli2Game message definitions
*
***/
static const NetMsgField kPingRequestFields[] = {
kNetMsgFieldTimeMs, // pingTimeMs
};
static const NetMsgField kJoinAgeRequestFields[] = {
kNetMsgFieldTransId, // transId
NET_MSG_FIELD_DWORD(), // ageMcpId
kNetMsgFieldUuid, // accountUuid
NET_MSG_FIELD_DWORD(), // playerInt
};
static const NetMsgField kPropagateBufferFields[] = {
NET_MSG_FIELD_DWORD(), // type
NET_MSG_FIELD_VAR_COUNT(1, 1024 * 1024), // bytes
NET_MSG_FIELD_VAR_PTR(), // buffer
};
static const NetMsgField kGameMgrMsgFields[] = {
NET_MSG_FIELD_VAR_COUNT(1, 1024 * 1024), // bytes
NET_MSG_FIELD_VAR_PTR(), // buffer
};
/*****************************************************************************
*
* Game2Cli message fields
*
***/
static const NetMsgField kPingReplyFields[] = {
kNetMsgFieldTimeMs, // pingTimeMs
};
static const NetMsgField kJoinAgeReplyFields[] = {
kNetMsgFieldTransId, // transId
kNetMsgFieldENetError, // result
};
} using namespace Cli2Game;
/*****************************************************************************
*
* Exported data
*
***/
// Cli2Game
const NetMsg kNetMsg_Cli2Game_PingRequest = NET_MSG(kCli2Game_PingRequest, kPingRequestFields);
const NetMsg kNetMsg_Cli2Game_JoinAgeRequest = NET_MSG(kCli2Game_JoinAgeRequest, kJoinAgeRequestFields);
const NetMsg kNetMsg_Cli2Game_PropagateBuffer = NET_MSG(kCli2Game_PropagateBuffer, kPropagateBufferFields);
const NetMsg kNetMsg_Cli2Game_GameMgrMsg = NET_MSG(kCli2Game_GameMgrMsg, kGameMgrMsgFields);
// Game2Cli
const NetMsg kNetMsg_Game2Cli_PingReply = NET_MSG(kGame2Cli_PingReply, kPingReplyFields);
const NetMsg kNetMsg_Game2Cli_JoinAgeReply = NET_MSG(kGame2Cli_JoinAgeReply, kJoinAgeReplyFields);
const NetMsg kNetMsg_Game2Cli_PropagateBuffer = NET_MSG(kGame2Cli_PropagateBuffer, kPropagateBufferFields);
const NetMsg kNetMsg_Game2Cli_GameMgrMsg = NET_MSG(kGame2Cli_GameMgrMsg, kGameMgrMsgFields);

View File

@ -1,178 +1,178 @@
/*==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/pnNetProtocol/Private/Protocols/Cli2Game/pnNpCli2Game.h
*
***/
#ifdef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETPROTOCOL_PRIVATE_PROTOCOLS_CLI2GAME_PNNPCLI2GAME_H
#error "Header $/Plasma20/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Cli2Game/pnNpCli2Game.h included more than once"
#endif
#define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETPROTOCOL_PRIVATE_PROTOCOLS_CLI2GAME_PNNPCLI2GAME_H
// kNetProtocolCli2Game messages
enum {
// Global
kCli2Game_PingRequest,
// Age
kCli2Game_JoinAgeRequest,
// Game
kCli2Game_PropagateBuffer,
kCli2Game_GameMgrMsg,
kNumCli2GameMessages
};
COMPILER_ASSERT_HEADER(Cli2Game, kNumCli2GameMessages <= (word)-1);
enum {
// Global
kGame2Cli_PingReply,
// Age
kGame2Cli_JoinAgeReply,
// Game
kGame2Cli_PropagateBuffer,
kGame2Cli_GameMgrMsg,
kNumGame2CliMessages
};
COMPILER_ASSERT_HEADER(Cli2Game, kNumGame2CliMessages <= (word)-1);
//============================================================================
// BEGIN PACKED DATA STRUCTURES
//============================================================================
#include <PshPack1.h>
/*****************************************************************************
*
* Cli2Game connect packet
*
***/
struct Cli2Game_ConnData {
dword dataBytes;
Uuid accountUuid;
Uuid ageUuid;
};
struct Cli2Game_Connect {
AsyncSocketConnectPacket hdr;
Cli2Game_ConnData data;
};
/*****************************************************************************
*
* Cli2Game message structures
*
***/
// PingRequest
extern const NetMsg kNetMsg_Cli2Game_PingRequest;
struct Cli2Game_PingRequest {
dword messageId;
dword pingTimeMs;
};
// JoinAgeRequest
extern const NetMsg kNetMsg_Cli2Game_JoinAgeRequest;
struct Cli2Game_JoinAgeRequest {
dword messageId;
dword transId;
dword ageMcpId;
Uuid accountUuid;
dword playerInt;
};
// PropagateBuffer
extern const NetMsg kNetMsg_Cli2Game_PropagateBuffer;
struct Cli2Game_PropagateBuffer {
dword messageId;
dword type;
dword bytes;
byte buffer[1]; // actually, buffer[bytes]
// no more fields
};
// GameMgrMsg
extern const NetMsg kNetMsg_Cli2Game_GameMgrMsg;
struct Cli2Game_GameMgrMsg {
dword messageId;
dword bytes;
byte buffer[1]; // actually: buffer[bytes]
};
/*****************************************************************************
*
* Game2Cli message structures
*
***/
// PingReply
extern const NetMsg kNetMsg_Game2Cli_PingReply;
struct Game2Cli_PingReply{
dword messageId;
dword pingTimeMs;
};
// JoinAgeReply
extern const NetMsg kNetMsg_Game2Cli_JoinAgeReply;
struct Game2Cli_JoinAgeReply {
dword messageId;
dword transId;
ENetError result;
};
// PropagateBuffer
extern const NetMsg kNetMsg_Game2Cli_PropagateBuffer;
struct Game2Cli_PropagateBuffer {
dword messageId;
dword type;
dword bytes;
byte buffer[1]; // actually, buffer[bytes]
// no more fields
};
// GameMgrMsg
extern const NetMsg kNetMsg_Game2Cli_GameMgrMsg;
struct Game2Cli_GameMgrMsg {
dword messageId;
dword bytes;
byte buffer[1]; // actually: buffer[bytes]
};
//============================================================================
// END PACKED DATA STRUCTURES
//============================================================================
#include <PopPack.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/>.
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/pnNetProtocol/Private/Protocols/Cli2Game/pnNpCli2Game.h
*
***/
#ifdef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETPROTOCOL_PRIVATE_PROTOCOLS_CLI2GAME_PNNPCLI2GAME_H
#error "Header $/Plasma20/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Cli2Game/pnNpCli2Game.h included more than once"
#endif
#define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETPROTOCOL_PRIVATE_PROTOCOLS_CLI2GAME_PNNPCLI2GAME_H
// kNetProtocolCli2Game messages
enum {
// Global
kCli2Game_PingRequest,
// Age
kCli2Game_JoinAgeRequest,
// Game
kCli2Game_PropagateBuffer,
kCli2Game_GameMgrMsg,
kNumCli2GameMessages
};
COMPILER_ASSERT_HEADER(Cli2Game, kNumCli2GameMessages <= (word)-1);
enum {
// Global
kGame2Cli_PingReply,
// Age
kGame2Cli_JoinAgeReply,
// Game
kGame2Cli_PropagateBuffer,
kGame2Cli_GameMgrMsg,
kNumGame2CliMessages
};
COMPILER_ASSERT_HEADER(Cli2Game, kNumGame2CliMessages <= (word)-1);
//============================================================================
// BEGIN PACKED DATA STRUCTURES
//============================================================================
#include <PshPack1.h>
/*****************************************************************************
*
* Cli2Game connect packet
*
***/
struct Cli2Game_ConnData {
dword dataBytes;
Uuid accountUuid;
Uuid ageUuid;
};
struct Cli2Game_Connect {
AsyncSocketConnectPacket hdr;
Cli2Game_ConnData data;
};
/*****************************************************************************
*
* Cli2Game message structures
*
***/
// PingRequest
extern const NetMsg kNetMsg_Cli2Game_PingRequest;
struct Cli2Game_PingRequest {
dword messageId;
dword pingTimeMs;
};
// JoinAgeRequest
extern const NetMsg kNetMsg_Cli2Game_JoinAgeRequest;
struct Cli2Game_JoinAgeRequest {
dword messageId;
dword transId;
dword ageMcpId;
Uuid accountUuid;
dword playerInt;
};
// PropagateBuffer
extern const NetMsg kNetMsg_Cli2Game_PropagateBuffer;
struct Cli2Game_PropagateBuffer {
dword messageId;
dword type;
dword bytes;
byte buffer[1]; // actually, buffer[bytes]
// no more fields
};
// GameMgrMsg
extern const NetMsg kNetMsg_Cli2Game_GameMgrMsg;
struct Cli2Game_GameMgrMsg {
dword messageId;
dword bytes;
byte buffer[1]; // actually: buffer[bytes]
};
/*****************************************************************************
*
* Game2Cli message structures
*
***/
// PingReply
extern const NetMsg kNetMsg_Game2Cli_PingReply;
struct Game2Cli_PingReply{
dword messageId;
dword pingTimeMs;
};
// JoinAgeReply
extern const NetMsg kNetMsg_Game2Cli_JoinAgeReply;
struct Game2Cli_JoinAgeReply {
dword messageId;
dword transId;
ENetError result;
};
// PropagateBuffer
extern const NetMsg kNetMsg_Game2Cli_PropagateBuffer;
struct Game2Cli_PropagateBuffer {
dword messageId;
dword type;
dword bytes;
byte buffer[1]; // actually, buffer[bytes]
// no more fields
};
// GameMgrMsg
extern const NetMsg kNetMsg_Game2Cli_GameMgrMsg;
struct Game2Cli_GameMgrMsg {
dword messageId;
dword bytes;
byte buffer[1]; // actually: buffer[bytes]
};
//============================================================================
// END PACKED DATA STRUCTURES
//============================================================================
#include <PopPack.h>

View File

@ -1,94 +1,94 @@
/*==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/pnNetProtocol/Private/Protocols/pnNpCli2Auth.cpp
*
***/
#define USES_PROTOCOL_CLI2GATEKEEPER
#include "../../../Pch.h"
#pragma hdrstop
namespace Cli2GateKeeper {
/*****************************************************************************
*
* Cli2GateKeeper message field definitions
*
***/
static const NetMsgField kPingRequestFields[] = {
kNetMsgFieldTransId, // transId
kNetMsgFieldTimeMs, // pingTimeMs
NET_MSG_FIELD_VAR_COUNT(1, 64 * 1024), // payloadBytes
NET_MSG_FIELD_VAR_PTR(), // payload
};
static const NetMsgField kFileSrvIpAddressRequestFields[] = {
kNetMsgFieldTransId, // transId
NET_MSG_FIELD_BYTE(), // isPatcher
};
static const NetMsgField kAuthSrvIpAddressRequestFields[] = {
kNetMsgFieldTransId, // transId
};
/*****************************************************************************
*
* GateKeeper2Cli message field definitions
*
***/
static const NetMsgField kPingReplyFields[] = {
kNetMsgFieldTransId, // transId
kNetMsgFieldTimeMs, // pingTimeMs
NET_MSG_FIELD_VAR_COUNT(1, 64 * 1024), // payloadBytes
NET_MSG_FIELD_VAR_PTR(), // payload
};
static const NetMsgField kFileSrvIpAddressReplyFields[] = {
kNetMsgFieldTransId, // transId
NET_MSG_FIELD_STRING(24), // IpAddress
};
static const NetMsgField kAuthSrvIpAddressReplyFields[] = {
kNetMsgFieldTransId, // transId
NET_MSG_FIELD_STRING(24), // IpAddress
};
} using namespace Cli2GateKeeper;
const NetMsg kNetMsg_Cli2GateKeeper_PingRequest = NET_MSG(kCli2GateKeeper_PingRequest, kPingRequestFields);
const NetMsg kNetMsg_Cli2GateKeeper_FileSrvIpAddressRequest = NET_MSG(kCli2GateKeeper_FileSrvIpAddressRequest, kFileSrvIpAddressRequestFields);
const NetMsg kNetMsg_Cli2GateKeeper_AuthSrvIpAddressRequest = NET_MSG(kCli2GateKeeper_AuthSrvIpAddressRequest, kAuthSrvIpAddressRequestFields);
const NetMsg kNetMsg_GateKeeper2Cli_PingReply = NET_MSG(kGateKeeper2Cli_PingReply, kPingReplyFields);
const NetMsg kNetMsg_GateKeeper2Cli_FileSrvIpAddressReply = NET_MSG(kGateKeeper2Cli_FileSrvIpAddressReply, kFileSrvIpAddressReplyFields);
const NetMsg kNetMsg_GateKeeper2Cli_AuthSrvIpAddressReply = NET_MSG(kGateKeeper2Cli_AuthSrvIpAddressReply, kAuthSrvIpAddressReplyFields);
/*==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/pnNetProtocol/Private/Protocols/pnNpCli2Auth.cpp
*
***/
#define USES_PROTOCOL_CLI2GATEKEEPER
#include "../../../Pch.h"
#pragma hdrstop
namespace Cli2GateKeeper {
/*****************************************************************************
*
* Cli2GateKeeper message field definitions
*
***/
static const NetMsgField kPingRequestFields[] = {
kNetMsgFieldTransId, // transId
kNetMsgFieldTimeMs, // pingTimeMs
NET_MSG_FIELD_VAR_COUNT(1, 64 * 1024), // payloadBytes
NET_MSG_FIELD_VAR_PTR(), // payload
};
static const NetMsgField kFileSrvIpAddressRequestFields[] = {
kNetMsgFieldTransId, // transId
NET_MSG_FIELD_BYTE(), // isPatcher
};
static const NetMsgField kAuthSrvIpAddressRequestFields[] = {
kNetMsgFieldTransId, // transId
};
/*****************************************************************************
*
* GateKeeper2Cli message field definitions
*
***/
static const NetMsgField kPingReplyFields[] = {
kNetMsgFieldTransId, // transId
kNetMsgFieldTimeMs, // pingTimeMs
NET_MSG_FIELD_VAR_COUNT(1, 64 * 1024), // payloadBytes
NET_MSG_FIELD_VAR_PTR(), // payload
};
static const NetMsgField kFileSrvIpAddressReplyFields[] = {
kNetMsgFieldTransId, // transId
NET_MSG_FIELD_STRING(24), // IpAddress
};
static const NetMsgField kAuthSrvIpAddressReplyFields[] = {
kNetMsgFieldTransId, // transId
NET_MSG_FIELD_STRING(24), // IpAddress
};
} using namespace Cli2GateKeeper;
const NetMsg kNetMsg_Cli2GateKeeper_PingRequest = NET_MSG(kCli2GateKeeper_PingRequest, kPingRequestFields);
const NetMsg kNetMsg_Cli2GateKeeper_FileSrvIpAddressRequest = NET_MSG(kCli2GateKeeper_FileSrvIpAddressRequest, kFileSrvIpAddressRequestFields);
const NetMsg kNetMsg_Cli2GateKeeper_AuthSrvIpAddressRequest = NET_MSG(kCli2GateKeeper_AuthSrvIpAddressRequest, kAuthSrvIpAddressRequestFields);
const NetMsg kNetMsg_GateKeeper2Cli_PingReply = NET_MSG(kGateKeeper2Cli_PingReply, kPingReplyFields);
const NetMsg kNetMsg_GateKeeper2Cli_FileSrvIpAddressReply = NET_MSG(kGateKeeper2Cli_FileSrvIpAddressReply, kFileSrvIpAddressReplyFields);
const NetMsg kNetMsg_GateKeeper2Cli_AuthSrvIpAddressReply = NET_MSG(kGateKeeper2Cli_AuthSrvIpAddressReply, kAuthSrvIpAddressReplyFields);

View File

@ -1,141 +1,141 @@
/*==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/pnNetProtocol/Private/Protocols/pnNpCli2GateKeeper.h
*
***/
#ifdef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETPROTOCOL_PRIVATE_PROTOCOLS_PNNPCLI2GATEKEEPER_H
#error "Header $/Plasma20/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/pnNpCli2GateKeeper.h included more than once"
#endif
#define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETPROTOCOL_PRIVATE_PROTOCOLS_PNNPCLI2GATEKEEPER_H
// kNetProtocolCli2GateKeeper messages (must be <= (word)-1)
enum {
// Global
kCli2GateKeeper_PingRequest,
kCli2GateKeeper_FileSrvIpAddressRequest,
kCli2GateKeeper_AuthSrvIpAddressRequest,
kNumCli2GateKeeperMessages
};
COMPILER_ASSERT_HEADER(Cli2GateKeeper, kNumCli2GateKeeperMessages <= (word)-1);
enum {
// Global
kGateKeeper2Cli_PingReply,
kGateKeeper2Cli_FileSrvIpAddressReply,
kGateKeeper2Cli_AuthSrvIpAddressReply,
kNumGateKeeper2CliMessages
};
COMPILER_ASSERT_HEADER(Cli2GateKeeper, kNumGateKeeper2CliMessages <= (word)-1);
//============================================================================
// BEGIN PACKED DATA STRUCTURES
//============================================================================
#include <PshPack1.h>
/*****************************************************************************
*
* Cli2GateKeeper connect packet
*
***/
struct Cli2GateKeeper_ConnData {
dword dataBytes;
Uuid token;
};
struct Cli2GateKeeper_Connect {
AsyncSocketConnectPacket hdr;
Cli2GateKeeper_ConnData data;
};
//============================================================================
// Cli --> GateKeeper message structures
// PingRequest
extern const NetMsg kNetMsg_Cli2GateKeeper_PingRequest;
struct Cli2GateKeeper_PingRequest {
dword messageId;
dword transId;
dword pingTimeMs;
dword payloadBytes;
byte payload[1]; // [payloadBytes]
};
// FileSrvIpAddressRequest
extern const NetMsg kNetMsg_Cli2GateKeeper_FileSrvIpAddressRequest;
struct Cli2GateKeeper_FileSrvIpAddressRequest {
dword messageId;
dword transId;
byte isPatcher;
};
// AuthSrvIpAddressRequest
extern const NetMsg kNetMsg_Cli2GateKeeper_AuthSrvIpAddressRequest;
struct Cli2GateKeeper_AuthSrvIpAddressRequest {
dword messageId;
dword transId;
};
//============================================================================
// GateKeeper --> Cli message structures
// PingReply
extern const NetMsg kNetMsg_GateKeeper2Cli_PingReply;
struct GateKeeper2Cli_PingReply {
dword messageId;
dword transId;
dword pingTimeMs;
dword payloadBytes;
byte payload[1]; // [payloadBytes]
};
// FileSrvIpAddressReply
extern const NetMsg kNetMsg_GateKeeper2Cli_FileSrvIpAddressReply;
struct GateKeeper2Cli_FileSrvIpAddressReply {
dword messageId;
dword transId;
wchar address[24];
};
// FileSrvIpAddressReply
extern const NetMsg kNetMsg_GateKeeper2Cli_AuthSrvIpAddressReply;
struct GateKeeper2Cli_AuthSrvIpAddressReply {
dword messageId;
dword transId;
wchar address[24];
/*==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/pnNetProtocol/Private/Protocols/pnNpCli2GateKeeper.h
*
***/
#ifdef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETPROTOCOL_PRIVATE_PROTOCOLS_PNNPCLI2GATEKEEPER_H
#error "Header $/Plasma20/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/pnNpCli2GateKeeper.h included more than once"
#endif
#define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETPROTOCOL_PRIVATE_PROTOCOLS_PNNPCLI2GATEKEEPER_H
// kNetProtocolCli2GateKeeper messages (must be <= (word)-1)
enum {
// Global
kCli2GateKeeper_PingRequest,
kCli2GateKeeper_FileSrvIpAddressRequest,
kCli2GateKeeper_AuthSrvIpAddressRequest,
kNumCli2GateKeeperMessages
};
COMPILER_ASSERT_HEADER(Cli2GateKeeper, kNumCli2GateKeeperMessages <= (word)-1);
enum {
// Global
kGateKeeper2Cli_PingReply,
kGateKeeper2Cli_FileSrvIpAddressReply,
kGateKeeper2Cli_AuthSrvIpAddressReply,
kNumGateKeeper2CliMessages
};
COMPILER_ASSERT_HEADER(Cli2GateKeeper, kNumGateKeeper2CliMessages <= (word)-1);
//============================================================================
// BEGIN PACKED DATA STRUCTURES
//============================================================================
#include <PshPack1.h>
/*****************************************************************************
*
* Cli2GateKeeper connect packet
*
***/
struct Cli2GateKeeper_ConnData {
dword dataBytes;
Uuid token;
};
struct Cli2GateKeeper_Connect {
AsyncSocketConnectPacket hdr;
Cli2GateKeeper_ConnData data;
};
//============================================================================
// Cli --> GateKeeper message structures
// PingRequest
extern const NetMsg kNetMsg_Cli2GateKeeper_PingRequest;
struct Cli2GateKeeper_PingRequest {
dword messageId;
dword transId;
dword pingTimeMs;
dword payloadBytes;
byte payload[1]; // [payloadBytes]
};
// FileSrvIpAddressRequest
extern const NetMsg kNetMsg_Cli2GateKeeper_FileSrvIpAddressRequest;
struct Cli2GateKeeper_FileSrvIpAddressRequest {
dword messageId;
dword transId;
byte isPatcher;
};
// AuthSrvIpAddressRequest
extern const NetMsg kNetMsg_Cli2GateKeeper_AuthSrvIpAddressRequest;
struct Cli2GateKeeper_AuthSrvIpAddressRequest {
dword messageId;
dword transId;
};
//============================================================================
// GateKeeper --> Cli message structures
// PingReply
extern const NetMsg kNetMsg_GateKeeper2Cli_PingReply;
struct GateKeeper2Cli_PingReply {
dword messageId;
dword transId;
dword pingTimeMs;
dword payloadBytes;
byte payload[1]; // [payloadBytes]
};
// FileSrvIpAddressReply
extern const NetMsg kNetMsg_GateKeeper2Cli_FileSrvIpAddressReply;
struct GateKeeper2Cli_FileSrvIpAddressReply {
dword messageId;
dword transId;
wchar address[24];
};
// FileSrvIpAddressReply
extern const NetMsg kNetMsg_GateKeeper2Cli_AuthSrvIpAddressReply;
struct GateKeeper2Cli_AuthSrvIpAddressReply {
dword messageId;
dword transId;
wchar address[24];
};

View File

@ -1,77 +1,77 @@
/*==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/pnNetProtocol/Private/Protocols/Srv2Db/pnNpSrv2Db.cpp
*
***/
#ifdef SERVER
#define USES_PROTOCOL_SRV2DB
#include "../../../Pch.h"
#pragma hdrstop
/*****************************************************************************
*
* Exports
*
***/
//===========================================================================
bool Srv2DbValidateConnect (
AsyncNotifySocketListen * listen,
Srv2Db_ConnData * connectPtr
) {
// Ensure that there are enough bytes for the header
const Srv2Db_ConnData & connect = * (const Srv2Db_ConnData *) listen->buffer;
// Validate message size
const unsigned kMinStructSize = sizeof(dword) * 1;
if (listen->bytes < kMinStructSize)
return false;
if (listen->bytes < connect.dataBytes)
return false;
// Validate connect server type
if (! (connect.srvType == kSrvTypeAuth
|| connect.srvType == kSrvTypeVault
|| connect.srvType == kSrvTypeState
|| connect.srvType == kSrvTypeScore
|| connect.srvType == kSrvTypeCsr)
) {
return false;
}
ZEROPTR(connectPtr);
MemCopy(connectPtr, &connect, min(sizeof(*connectPtr), connect.dataBytes));
listen->bytesProcessed += connect.dataBytes;
return true;
}
#endif // SERVER
/*==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/pnNetProtocol/Private/Protocols/Srv2Db/pnNpSrv2Db.cpp
*
***/
#ifdef SERVER
#define USES_PROTOCOL_SRV2DB
#include "../../../Pch.h"
#pragma hdrstop
/*****************************************************************************
*
* Exports
*
***/
//===========================================================================
bool Srv2DbValidateConnect (
AsyncNotifySocketListen * listen,
Srv2Db_ConnData * connectPtr
) {
// Ensure that there are enough bytes for the header
const Srv2Db_ConnData & connect = * (const Srv2Db_ConnData *) listen->buffer;
// Validate message size
const unsigned kMinStructSize = sizeof(dword) * 1;
if (listen->bytes < kMinStructSize)
return false;
if (listen->bytes < connect.dataBytes)
return false;
// Validate connect server type
if (! (connect.srvType == kSrvTypeAuth
|| connect.srvType == kSrvTypeVault
|| connect.srvType == kSrvTypeState
|| connect.srvType == kSrvTypeScore
|| connect.srvType == kSrvTypeCsr)
) {
return false;
}
ZEROPTR(connectPtr);
MemCopy(connectPtr, &connect, min(sizeof(*connectPtr), connect.dataBytes));
listen->bytesProcessed += connect.dataBytes;
return true;
}
#endif // SERVER

View File

@ -1,74 +1,74 @@
/*==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/pnNetProtocol/Private/Protocols/Srv2Log/pnNpSrv2Log.cpp
*
***/
#ifdef SERVER
#define USES_PROTOCOL_SRV2LOG
#include "../../../Pch.h"
#pragma hdrstop
/*****************************************************************************
*
* Exports
*
***/
//===========================================================================
bool Srv2LogValidateConnect (
AsyncNotifySocketListen * listen,
Srv2Log_ConnData * connectPtr
) {
// Ensure that there are enough bytes for the header
const Srv2Log_ConnData & connect = * (const Srv2Log_ConnData *) listen->buffer;
// Validate message size
const unsigned kMinStructSize = sizeof(dword) * 3;
if (listen->bytes < kMinStructSize)
return false;
if (listen->bytes < connect.dataBytes)
return false;
// Validate connect server type
if (!(connect.srvType == kSrvTypeAuth || connect.srvType == kSrvTypeGame || connect.srvType == kSrvTypeVault || connect.srvType == kSrvTypeDb ||
connect.srvType == kSrvTypeMcp || connect.srvType == kSrvTypeState || connect.srvType == kSrvTypeFile || connect.srvType == kSrvTypeDll))
return false;
ZEROPTR(connectPtr);
MemCopy(connectPtr, &connect, min(sizeof(*connectPtr), connect.dataBytes));
listen->bytesProcessed += connect.dataBytes;
return true;
}
#endif // SERVER
/*==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/pnNetProtocol/Private/Protocols/Srv2Log/pnNpSrv2Log.cpp
*
***/
#ifdef SERVER
#define USES_PROTOCOL_SRV2LOG
#include "../../../Pch.h"
#pragma hdrstop
/*****************************************************************************
*
* Exports
*
***/
//===========================================================================
bool Srv2LogValidateConnect (
AsyncNotifySocketListen * listen,
Srv2Log_ConnData * connectPtr
) {
// Ensure that there are enough bytes for the header
const Srv2Log_ConnData & connect = * (const Srv2Log_ConnData *) listen->buffer;
// Validate message size
const unsigned kMinStructSize = sizeof(dword) * 3;
if (listen->bytes < kMinStructSize)
return false;
if (listen->bytes < connect.dataBytes)
return false;
// Validate connect server type
if (!(connect.srvType == kSrvTypeAuth || connect.srvType == kSrvTypeGame || connect.srvType == kSrvTypeVault || connect.srvType == kSrvTypeDb ||
connect.srvType == kSrvTypeMcp || connect.srvType == kSrvTypeState || connect.srvType == kSrvTypeFile || connect.srvType == kSrvTypeDll))
return false;
ZEROPTR(connectPtr);
MemCopy(connectPtr, &connect, min(sizeof(*connectPtr), connect.dataBytes));
listen->bytesProcessed += connect.dataBytes;
return true;
}
#endif // SERVER

View File

@ -1,104 +1,104 @@
/*==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/pnNetProtocol/Private/Protocols/Srv2Log/pnNpSrv2Log.h
*
***/
#ifdef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETPROTOCOL_PRIVATE_PROTOCOLS_SRV2LOG_PNNPSRV2LOG_H
#error "Header $/Plasma20/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Log/pnNpSrv2Log.h included more than once"
#endif
#define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETPROTOCOL_PRIVATE_PROTOCOLS_SRV2LOG_PNNPSRV2LOG_H
//============================================================================
// BEGIN PACKED DATA STRUCTURES
//============================================================================
#include <PshPack1.h>
// Srv2Log
enum {
kSrv2Log_LogMsg = 0,
};
// Log2Srv
enum {
};
/*****************************************************************************
*
* Srv2State connect packet
*
***/
struct Srv2Log_ConnData {
dword dataBytes;
dword buildId;
dword srvType;
dword buildType;
dword productId;
};
struct Srv2Log_Connect {
AsyncSocketConnectPacket hdr;
Srv2Log_ConnData data;
};
/*****************************************************************************
*
* Srv2Log message structures
*
***/
struct Srv2Log_LogMsg : SrvMsgHeader {
unsigned eventType;
qword timestamp;
};
//============================================================================
// END PACKED DATA STRUCTURES
//============================================================================
#include <PopPack.h>
/*****************************************************************************
*
* Srv2State functions
*
***/
bool Srv2LogValidateConnect (
AsyncNotifySocketListen * listen,
Srv2Log_ConnData * connectPtr
);
/*==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/pnNetProtocol/Private/Protocols/Srv2Log/pnNpSrv2Log.h
*
***/
#ifdef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETPROTOCOL_PRIVATE_PROTOCOLS_SRV2LOG_PNNPSRV2LOG_H
#error "Header $/Plasma20/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Log/pnNpSrv2Log.h included more than once"
#endif
#define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETPROTOCOL_PRIVATE_PROTOCOLS_SRV2LOG_PNNPSRV2LOG_H
//============================================================================
// BEGIN PACKED DATA STRUCTURES
//============================================================================
#include <PshPack1.h>
// Srv2Log
enum {
kSrv2Log_LogMsg = 0,
};
// Log2Srv
enum {
};
/*****************************************************************************
*
* Srv2State connect packet
*
***/
struct Srv2Log_ConnData {
dword dataBytes;
dword buildId;
dword srvType;
dword buildType;
dword productId;
};
struct Srv2Log_Connect {
AsyncSocketConnectPacket hdr;
Srv2Log_ConnData data;
};
/*****************************************************************************
*
* Srv2Log message structures
*
***/
struct Srv2Log_LogMsg : SrvMsgHeader {
unsigned eventType;
qword timestamp;
};
//============================================================================
// END PACKED DATA STRUCTURES
//============================================================================
#include <PopPack.h>
/*****************************************************************************
*
* Srv2State functions
*
***/
bool Srv2LogValidateConnect (
AsyncNotifySocketListen * listen,
Srv2Log_ConnData * connectPtr
);

View File

@ -1,71 +1,71 @@
/*==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/pnNetProtocol/Private/Protocols/Srv2Mcp/pnNpSrv2Mcp.cpp
*
***/
#ifdef SERVER
#define USES_PROTOCOL_SRV2MCP
#include "../../../Pch.h"
#pragma hdrstop
/*****************************************************************************
*
* Exports
*
***/
//===========================================================================
bool Srv2McpValidateConnect (
AsyncNotifySocketListen * listen,
Srv2Mcp_ConnData * connectPtr
) {
// Ensure that there are enough bytes for the header
const Srv2Mcp_ConnData & connect = * (const Srv2Mcp_ConnData *) listen->buffer;
// Validate message size
const unsigned kMinStructSize = sizeof(dword) * 3;
if (listen->bytes < kMinStructSize)
return false;
if (listen->bytes < connect.dataBytes)
return false;
// Validate connect server type
if (!(connect.srvType == kSrvTypeAuth || connect.srvType == kSrvTypeGame))
return false;
ZEROPTR(connectPtr);
MemCopy(connectPtr, &connect, min(sizeof(*connectPtr), connect.dataBytes));
listen->bytesProcessed += connect.dataBytes;
return true;
}
#endif // SERVER
/*==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/pnNetProtocol/Private/Protocols/Srv2Mcp/pnNpSrv2Mcp.cpp
*
***/
#ifdef SERVER
#define USES_PROTOCOL_SRV2MCP
#include "../../../Pch.h"
#pragma hdrstop
/*****************************************************************************
*
* Exports
*
***/
//===========================================================================
bool Srv2McpValidateConnect (
AsyncNotifySocketListen * listen,
Srv2Mcp_ConnData * connectPtr
) {
// Ensure that there are enough bytes for the header
const Srv2Mcp_ConnData & connect = * (const Srv2Mcp_ConnData *) listen->buffer;
// Validate message size
const unsigned kMinStructSize = sizeof(dword) * 3;
if (listen->bytes < kMinStructSize)
return false;
if (listen->bytes < connect.dataBytes)
return false;
// Validate connect server type
if (!(connect.srvType == kSrvTypeAuth || connect.srvType == kSrvTypeGame))
return false;
ZEROPTR(connectPtr);
MemCopy(connectPtr, &connect, min(sizeof(*connectPtr), connect.dataBytes));
listen->bytesProcessed += connect.dataBytes;
return true;
}
#endif // SERVER

View File

@ -1,251 +1,251 @@
/*==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/pnNetProtocol/Private/Protocols/Srv2Mcp/pnNpSrv2Mcp.h
*
***/
#ifdef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETPROTOCOL_PRIVATE_PROTOCOLS_SRV2MCP_PNNPSRV2MCP_H
#error "Header $/Plasma20/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Mcp/pnNpSrv2Mcp.h included more than once"
#endif
#define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETPROTOCOL_PRIVATE_PROTOCOLS_SRV2MCP_PNNPSRV2MCP_H
// kNetProtocolSrv2Mcp messages
// Because SrvMcp must remain compatible with older auth builds, these message ids
// must not change unless all front-end servers are synchronously replaced.
enum {
// Age
kSrv2Mcp_AgeJoinRequest = 0,
kSrv2Mcp_PlayerLoggedOut = 1,
kSrv2Mcp_PlayerLoggedIn = 2,
kSrv2Mcp_AgeSpawned = 3,
kSrv2Mcp_AgeDied = 4,
kSrv2Mcp_KickPlayer = 5,
// Account
kSrv2Mcp_AccountLoginRequest = 20,
kSrv2Mcp_AccountLogout = 21,
kSrv2Mcp_AccountSetPlayer = 22,
// Messaging
kSrv2Mcp_PropagateBuffer = 30,
};
enum {
// Age
kMcp2Srv_AgeJoinReply = 0,
kMcp2Srv_AgeSpawnRequest = 1,
kMcp2Srv_AgeAddPlayerRequest = 2,
kMcp2Srv_AgeRemovePlayerRequest = 3,
kMcp2Srv_AgeUnspawn = 4,
kMcp2Srv_AgeSpawnedReply = 5,
// Account
kMcp2Srv_AccountLoginReply = 20,
kMcp2Srv_AccountNotifyKicked = 21,
// Messaging
kMcp2Srv_PropagateBuffer = 30,
// AgeSDL
kMcp2Srv_NotifyAgeSDLChanged = 40,
};
//============================================================================
// BEGIN PACKED DATA STRUCTURES
//============================================================================
#include <PshPack1.h>
/*****************************************************************************
*
* Srv2Mcp connect packet
*
***/
struct Srv2Mcp_ConnData {
dword dataBytes;
dword buildId;
dword srvType;
dword publicAddr;
};
struct Srv2Mcp_Connect {
AsyncSocketConnectPacket hdr;
Srv2Mcp_ConnData data;
};
/*****************************************************************************
*
* Srv2Mcp message structures
*
***/
struct Srv2Mcp_AgeJoinRequest : SrvMsgHeader {
wchar ageName[kMaxAgeNameLength];
Uuid ageUuid;
Uuid accountUuid;
dword playerInt;
byte ccrLevel;
wchar playerName[kMaxPlayerNameLength];
dword buildId;
};
struct Srv2Mcp_PlayerLoggedIn : SrvMsgHeader {
dword ageMcpId;
Uuid ageUuid;
Uuid accountUuid;
wchar playerName[kMaxPlayerNameLength];
dword playerInt;
};
struct Srv2Mcp_PlayerLoggedOut : SrvMsgHeader {
dword ageMcpId;
Uuid accountUuid;
dword playerInt;
};
struct Srv2Mcp_AgeSpawned : SrvMsgHeader {
wchar ageName[kMaxAgeNameLength];
Uuid ageUuid;
dword buildId;
};
struct Srv2Mcp_AgeDied : SrvMsgHeader {
dword ageMcpId;
};
struct Srv2Mcp_AccountLoginRequest : SrvMsgHeader {
wchar accountName[kMaxAccountNameLength];
Uuid accountUuid;
};
struct Srv2Mcp_AccountLogout : SrvMsgHeader {
Uuid accountUuid;
};
struct Srv2Mcp_AccountSetPlayer : SrvMsgHeader {
Uuid accountUuid;
dword playerInt;
};
struct Srv2Mcp_PropagateBuffer : SrvMsgHeader {
dword type;
dword bufferLength;
dword numRecvrs;
// packed data:
// byte netMessage[];
// dword playerlist[];
};
struct Srv2Mcp_KickPlayer : SrvMsgHeader {
dword playerInt;
};
/*****************************************************************************
*
* Mcp2Srv message structures
*
***/
struct Mcp2Srv_AgeJoinReply : SrvMsgHeader {
dword ageMcpId;
Uuid ageUuid;
NetAddressNode gameSrvNode;
};
struct Mcp2Srv_AgeSpawnRequest : SrvMsgHeader {
wchar ageName[kMaxAgeNameLength];
dword ageMcpId;
Uuid ageUuid;
dword buildId;
};
struct Mcp2Srv_AgeUnspawn : SrvMsgHeader {
dword ageMcpId;
};
struct Mcp2Srv_AgeAddPlayerRequest : SrvMsgHeader {
dword ageMcpId;
Uuid accountUuid;
dword playerInt;
byte ccrLevel;
wchar playerName[kMaxPlayerNameLength];
};
struct Mcp2Srv_AgeRemovePlayerRequest : SrvMsgHeader {
Uuid ageMcpId;
Uuid accountUuid;
dword playerInt;
};
struct Mcp2Srv_AgeSpawnedReply : SrvMsgHeader {
dword ageMcpId; // assigns a new mcpId if age wasn't found (in case of a reconnect)
};
struct Mcp2Srv_AccountLoginReply : SrvMsgHeader {
dword acctMcpId;
};
struct Mcp2Srv_AccountNotifyKicked : SrvMsgHeader {
Uuid accountUuid;
dword acctMcpId;
ENetError reason;
};
struct Mcp2Srv_NotifyAgeSDLChanged : SrvMsgHeader {
dword ageMcpId;
byte global;
};
struct Mcp2Srv_PropagateBuffer : SrvMsgHeader {
dword ageMcpId;
dword type;
dword bytes;
byte buffer[1]; // actually, buffer[bytes]
// no more fields
};
//============================================================================
// END PACKED DATA STRUCTURES
//============================================================================
#include <PopPack.h>
/*****************************************************************************
*
* Srv2Mcp functions
*
***/
bool Srv2McpValidateConnect (
AsyncNotifySocketListen * listen,
Srv2Mcp_ConnData * connectPtr
);
/*==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/pnNetProtocol/Private/Protocols/Srv2Mcp/pnNpSrv2Mcp.h
*
***/
#ifdef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETPROTOCOL_PRIVATE_PROTOCOLS_SRV2MCP_PNNPSRV2MCP_H
#error "Header $/Plasma20/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Mcp/pnNpSrv2Mcp.h included more than once"
#endif
#define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETPROTOCOL_PRIVATE_PROTOCOLS_SRV2MCP_PNNPSRV2MCP_H
// kNetProtocolSrv2Mcp messages
// Because SrvMcp must remain compatible with older auth builds, these message ids
// must not change unless all front-end servers are synchronously replaced.
enum {
// Age
kSrv2Mcp_AgeJoinRequest = 0,
kSrv2Mcp_PlayerLoggedOut = 1,
kSrv2Mcp_PlayerLoggedIn = 2,
kSrv2Mcp_AgeSpawned = 3,
kSrv2Mcp_AgeDied = 4,
kSrv2Mcp_KickPlayer = 5,
// Account
kSrv2Mcp_AccountLoginRequest = 20,
kSrv2Mcp_AccountLogout = 21,
kSrv2Mcp_AccountSetPlayer = 22,
// Messaging
kSrv2Mcp_PropagateBuffer = 30,
};
enum {
// Age
kMcp2Srv_AgeJoinReply = 0,
kMcp2Srv_AgeSpawnRequest = 1,
kMcp2Srv_AgeAddPlayerRequest = 2,
kMcp2Srv_AgeRemovePlayerRequest = 3,
kMcp2Srv_AgeUnspawn = 4,
kMcp2Srv_AgeSpawnedReply = 5,
// Account
kMcp2Srv_AccountLoginReply = 20,
kMcp2Srv_AccountNotifyKicked = 21,
// Messaging
kMcp2Srv_PropagateBuffer = 30,
// AgeSDL
kMcp2Srv_NotifyAgeSDLChanged = 40,
};
//============================================================================
// BEGIN PACKED DATA STRUCTURES
//============================================================================
#include <PshPack1.h>
/*****************************************************************************
*
* Srv2Mcp connect packet
*
***/
struct Srv2Mcp_ConnData {
dword dataBytes;
dword buildId;
dword srvType;
dword publicAddr;
};
struct Srv2Mcp_Connect {
AsyncSocketConnectPacket hdr;
Srv2Mcp_ConnData data;
};
/*****************************************************************************
*
* Srv2Mcp message structures
*
***/
struct Srv2Mcp_AgeJoinRequest : SrvMsgHeader {
wchar ageName[kMaxAgeNameLength];
Uuid ageUuid;
Uuid accountUuid;
dword playerInt;
byte ccrLevel;
wchar playerName[kMaxPlayerNameLength];
dword buildId;
};
struct Srv2Mcp_PlayerLoggedIn : SrvMsgHeader {
dword ageMcpId;
Uuid ageUuid;
Uuid accountUuid;
wchar playerName[kMaxPlayerNameLength];
dword playerInt;
};
struct Srv2Mcp_PlayerLoggedOut : SrvMsgHeader {
dword ageMcpId;
Uuid accountUuid;
dword playerInt;
};
struct Srv2Mcp_AgeSpawned : SrvMsgHeader {
wchar ageName[kMaxAgeNameLength];
Uuid ageUuid;
dword buildId;
};
struct Srv2Mcp_AgeDied : SrvMsgHeader {
dword ageMcpId;
};
struct Srv2Mcp_AccountLoginRequest : SrvMsgHeader {
wchar accountName[kMaxAccountNameLength];
Uuid accountUuid;
};
struct Srv2Mcp_AccountLogout : SrvMsgHeader {
Uuid accountUuid;
};
struct Srv2Mcp_AccountSetPlayer : SrvMsgHeader {
Uuid accountUuid;
dword playerInt;
};
struct Srv2Mcp_PropagateBuffer : SrvMsgHeader {
dword type;
dword bufferLength;
dword numRecvrs;
// packed data:
// byte netMessage[];
// dword playerlist[];
};
struct Srv2Mcp_KickPlayer : SrvMsgHeader {
dword playerInt;
};
/*****************************************************************************
*
* Mcp2Srv message structures
*
***/
struct Mcp2Srv_AgeJoinReply : SrvMsgHeader {
dword ageMcpId;
Uuid ageUuid;
NetAddressNode gameSrvNode;
};
struct Mcp2Srv_AgeSpawnRequest : SrvMsgHeader {
wchar ageName[kMaxAgeNameLength];
dword ageMcpId;
Uuid ageUuid;
dword buildId;
};
struct Mcp2Srv_AgeUnspawn : SrvMsgHeader {
dword ageMcpId;
};
struct Mcp2Srv_AgeAddPlayerRequest : SrvMsgHeader {
dword ageMcpId;
Uuid accountUuid;
dword playerInt;
byte ccrLevel;
wchar playerName[kMaxPlayerNameLength];
};
struct Mcp2Srv_AgeRemovePlayerRequest : SrvMsgHeader {
Uuid ageMcpId;
Uuid accountUuid;
dword playerInt;
};
struct Mcp2Srv_AgeSpawnedReply : SrvMsgHeader {
dword ageMcpId; // assigns a new mcpId if age wasn't found (in case of a reconnect)
};
struct Mcp2Srv_AccountLoginReply : SrvMsgHeader {
dword acctMcpId;
};
struct Mcp2Srv_AccountNotifyKicked : SrvMsgHeader {
Uuid accountUuid;
dword acctMcpId;
ENetError reason;
};
struct Mcp2Srv_NotifyAgeSDLChanged : SrvMsgHeader {
dword ageMcpId;
byte global;
};
struct Mcp2Srv_PropagateBuffer : SrvMsgHeader {
dword ageMcpId;
dword type;
dword bytes;
byte buffer[1]; // actually, buffer[bytes]
// no more fields
};
//============================================================================
// END PACKED DATA STRUCTURES
//============================================================================
#include <PopPack.h>
/*****************************************************************************
*
* Srv2Mcp functions
*
***/
bool Srv2McpValidateConnect (
AsyncNotifySocketListen * listen,
Srv2Mcp_ConnData * connectPtr
);

View File

@ -1,72 +1,72 @@
/*==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/pnNetProtocol/Private/Protocols/Srv2Score/pnNpSrv2Score.cpp
*
***/
#ifdef SERVER
#define USES_PROTOCOL_SRV2SCORE
#include "../../../Pch.h"
#pragma hdrstop
/*****************************************************************************
*
* Exports
*
***/
//===========================================================================
bool Srv2ScoreValidateConnect (
AsyncNotifySocketListen * listen,
Srv2Score_ConnData * connectPtr
) {
// Ensure that there are enough bytes for the header
const Srv2Score_ConnData & connect = * (const Srv2Score_ConnData *) listen->buffer;
// Validate message size
const unsigned kMinStructSize = sizeof(dword) * 3;
if (listen->bytes < kMinStructSize)
return false;
if (listen->bytes < connect.dataBytes)
return false;
// Validate connect server type
if (!(connect.srvType == kSrvTypeAuth || connect.srvType == kSrvTypeGame))
return false;
ZEROPTR(connectPtr);
MemCopy(connectPtr, &connect, min(sizeof(*connectPtr), connect.dataBytes));
listen->bytesProcessed += connect.dataBytes;
return true;
}
#endif // SERVER
/*==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/pnNetProtocol/Private/Protocols/Srv2Score/pnNpSrv2Score.cpp
*
***/
#ifdef SERVER
#define USES_PROTOCOL_SRV2SCORE
#include "../../../Pch.h"
#pragma hdrstop
/*****************************************************************************
*
* Exports
*
***/
//===========================================================================
bool Srv2ScoreValidateConnect (
AsyncNotifySocketListen * listen,
Srv2Score_ConnData * connectPtr
) {
// Ensure that there are enough bytes for the header
const Srv2Score_ConnData & connect = * (const Srv2Score_ConnData *) listen->buffer;
// Validate message size
const unsigned kMinStructSize = sizeof(dword) * 3;
if (listen->bytes < kMinStructSize)
return false;
if (listen->bytes < connect.dataBytes)
return false;
// Validate connect server type
if (!(connect.srvType == kSrvTypeAuth || connect.srvType == kSrvTypeGame))
return false;
ZEROPTR(connectPtr);
MemCopy(connectPtr, &connect, min(sizeof(*connectPtr), connect.dataBytes));
listen->bytesProcessed += connect.dataBytes;
return true;
}
#endif // SERVER

View File

@ -1,169 +1,169 @@
/*==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/pnNetProtocol/Private/Protocols/Srv2Score/pnNpSrv2Score.h
*
***/
#ifdef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETPROTOCOL_PRIVATE_PROTOCOLS_SRV2SCORE_PNNPSRV2SCORE_H
#error "Header $/Plasma20/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Score/pnNpSrv2Score.h included more than once"
#endif
#define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETPROTOCOL_PRIVATE_PROTOCOLS_SRV2SCORE_PNNPSRV2SCORE_H
//============================================================================
// BEGIN PACKED DATA STRUCTURES
//============================================================================
#include <PshPack1.h>
// kNetProtocolSrv2Score messages
enum {
kSrv2Score_ScoreCreate = 0,
kSrv2Score_ScoreGetScores = 1,
kSrv2Score_ScoreAddPoints = 2,
kSrv2Score_ScoreTransferPoints = 3,
kSrv2Score_ScoreSetPoints = 4,
kSrv2Score_ScoreDelete = 5,
kSrv2Score_ScoreGetRanks = 6,
};
enum {
kScore2Srv_ScoreCreateReply = 0,
kScore2Srv_ScoreGetScoresReply = 1,
kScore2Srv_ScoreDeleteReply = 2,
kScore2Srv_ScoreGetRanksReply = 3,
};
/*****************************************************************************
*
* Srv2Score connect packet
*
***/
struct Srv2Score_ConnData {
dword dataBytes;
dword buildId;
dword srvType;
};
struct Srv2Score_Connect {
AsyncSocketConnectPacket hdr;
Srv2Score_ConnData data;
};
/*****************************************************************************
*
* Srv2Score message structures
*
***/
struct Srv2Score_ScoreCreate : SrvMsgHeader {
dword ownerId;
wchar gameName[kMaxGameScoreNameLength];
dword gameType;
dword value;
};
struct Srv2Score_ScoreDelete : SrvMsgHeader {
dword scoreId;
};
struct Srv2Score_ScoreGetScores : SrvMsgHeader {
dword ownerId;
wchar gameName[kMaxGameScoreNameLength];
};
struct Srv2Score_ScoreAddPoints : SrvMsgHeader {
dword scoreId;
dword numPoints;
};
struct Srv2Score_ScoreTransferPoints : SrvMsgHeader {
dword srcScoreId;
dword destScoreId;
dword numPoints;
};
struct Srv2Score_ScoreSetPoints : SrvMsgHeader {
dword scoreId;
dword numPoints;
};
struct Srv2Score_ScoreGetRanks : SrvMsgHeader {
dword ownerId;
dword scoreGroup;
dword parentFolderId;
wchar gameName[kMaxGameScoreNameLength];
dword timePeriod;
dword numResults;
dword pageNumber;
dword sortDesc;
};
/*****************************************************************************
*
* Score2Srv message structures
*
***/
struct Score2Srv_ScoreCreateReply : SrvMsgHeader {
dword scoreId;
dword createdTime;
};
struct Score2Srv_ScoreGetScoresReply : SrvMsgHeader {
dword scoreCount;
dword byteCount;
byte buffer[1];
};
struct Score2Srv_ScoreGetRanksReply : SrvMsgHeader {
dword rankCount;
dword byteCount;
byte buffer[1];
};
//============================================================================
// END PACKED DATA STRUCTURES
//============================================================================
#include <PopPack.h>
/*****************************************************************************
*
* Srv2Score functions
*
***/
bool Srv2ScoreValidateConnect (
AsyncNotifySocketListen * listen,
Srv2Score_ConnData * connectPtr
);
/*==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/pnNetProtocol/Private/Protocols/Srv2Score/pnNpSrv2Score.h
*
***/
#ifdef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETPROTOCOL_PRIVATE_PROTOCOLS_SRV2SCORE_PNNPSRV2SCORE_H
#error "Header $/Plasma20/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Score/pnNpSrv2Score.h included more than once"
#endif
#define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETPROTOCOL_PRIVATE_PROTOCOLS_SRV2SCORE_PNNPSRV2SCORE_H
//============================================================================
// BEGIN PACKED DATA STRUCTURES
//============================================================================
#include <PshPack1.h>
// kNetProtocolSrv2Score messages
enum {
kSrv2Score_ScoreCreate = 0,
kSrv2Score_ScoreGetScores = 1,
kSrv2Score_ScoreAddPoints = 2,
kSrv2Score_ScoreTransferPoints = 3,
kSrv2Score_ScoreSetPoints = 4,
kSrv2Score_ScoreDelete = 5,
kSrv2Score_ScoreGetRanks = 6,
};
enum {
kScore2Srv_ScoreCreateReply = 0,
kScore2Srv_ScoreGetScoresReply = 1,
kScore2Srv_ScoreDeleteReply = 2,
kScore2Srv_ScoreGetRanksReply = 3,
};
/*****************************************************************************
*
* Srv2Score connect packet
*
***/
struct Srv2Score_ConnData {
dword dataBytes;
dword buildId;
dword srvType;
};
struct Srv2Score_Connect {
AsyncSocketConnectPacket hdr;
Srv2Score_ConnData data;
};
/*****************************************************************************
*
* Srv2Score message structures
*
***/
struct Srv2Score_ScoreCreate : SrvMsgHeader {
dword ownerId;
wchar gameName[kMaxGameScoreNameLength];
dword gameType;
dword value;
};
struct Srv2Score_ScoreDelete : SrvMsgHeader {
dword scoreId;
};
struct Srv2Score_ScoreGetScores : SrvMsgHeader {
dword ownerId;
wchar gameName[kMaxGameScoreNameLength];
};
struct Srv2Score_ScoreAddPoints : SrvMsgHeader {
dword scoreId;
dword numPoints;
};
struct Srv2Score_ScoreTransferPoints : SrvMsgHeader {
dword srcScoreId;
dword destScoreId;
dword numPoints;
};
struct Srv2Score_ScoreSetPoints : SrvMsgHeader {
dword scoreId;
dword numPoints;
};
struct Srv2Score_ScoreGetRanks : SrvMsgHeader {
dword ownerId;
dword scoreGroup;
dword parentFolderId;
wchar gameName[kMaxGameScoreNameLength];
dword timePeriod;
dword numResults;
dword pageNumber;
dword sortDesc;
};
/*****************************************************************************
*
* Score2Srv message structures
*
***/
struct Score2Srv_ScoreCreateReply : SrvMsgHeader {
dword scoreId;
dword createdTime;
};
struct Score2Srv_ScoreGetScoresReply : SrvMsgHeader {
dword scoreCount;
dword byteCount;
byte buffer[1];
};
struct Score2Srv_ScoreGetRanksReply : SrvMsgHeader {
dword rankCount;
dword byteCount;
byte buffer[1];
};
//============================================================================
// END PACKED DATA STRUCTURES
//============================================================================
#include <PopPack.h>
/*****************************************************************************
*
* Srv2Score functions
*
***/
bool Srv2ScoreValidateConnect (
AsyncNotifySocketListen * listen,
Srv2Score_ConnData * connectPtr
);

View File

@ -1,72 +1,72 @@
/*==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/pnNetProtocol/Private/Protocols/Srv2State/pnNpSrv2State.cpp
*
***/
#ifdef SERVER
#define USES_PROTOCOL_SRV2STATE
#include "../../../Pch.h"
#pragma hdrstop
/*****************************************************************************
*
* Exports
*
***/
//===========================================================================
bool Srv2StateValidateConnect (
AsyncNotifySocketListen * listen,
Srv2State_ConnData * connectPtr
) {
// Ensure that there are enough bytes for the header
const Srv2State_ConnData & connect = * (const Srv2State_ConnData *) listen->buffer;
// Validate message size
const unsigned kMinStructSize = sizeof(dword) * 3;
if (listen->bytes < kMinStructSize)
return false;
if (listen->bytes < connect.dataBytes)
return false;
// Validate connect server type
if (!(connect.srvType == kSrvTypeAuth || connect.srvType == kSrvTypeGame))
return false;
ZEROPTR(connectPtr);
MemCopy(connectPtr, &connect, min(sizeof(*connectPtr), connect.dataBytes));
listen->bytesProcessed += connect.dataBytes;
return true;
}
#endif // SERVER
/*==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/pnNetProtocol/Private/Protocols/Srv2State/pnNpSrv2State.cpp
*
***/
#ifdef SERVER
#define USES_PROTOCOL_SRV2STATE
#include "../../../Pch.h"
#pragma hdrstop
/*****************************************************************************
*
* Exports
*
***/
//===========================================================================
bool Srv2StateValidateConnect (
AsyncNotifySocketListen * listen,
Srv2State_ConnData * connectPtr
) {
// Ensure that there are enough bytes for the header
const Srv2State_ConnData & connect = * (const Srv2State_ConnData *) listen->buffer;
// Validate message size
const unsigned kMinStructSize = sizeof(dword) * 3;
if (listen->bytes < kMinStructSize)
return false;
if (listen->bytes < connect.dataBytes)
return false;
// Validate connect server type
if (!(connect.srvType == kSrvTypeAuth || connect.srvType == kSrvTypeGame))
return false;
ZEROPTR(connectPtr);
MemCopy(connectPtr, &connect, min(sizeof(*connectPtr), connect.dataBytes));
listen->bytesProcessed += connect.dataBytes;
return true;
}
#endif // SERVER

View File

@ -1,131 +1,131 @@
/*==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/pnNetProtocol/Private/Protocols/Srv2State/pnNpSrv2State.h
*
***/
#ifdef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETPROTOCOL_PRIVATE_PROTOCOLS_SRV2STATE_PNNPSRV2STATE_H
#error "Header $/Plasma20/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2State/pnNpSrv2State.h included more than once"
#endif
#define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETPROTOCOL_PRIVATE_PROTOCOLS_SRV2STATE_PNNPSRV2STATE_H
// kNetProtocolSrv2State messages
// Because SrvState must remain compatible with older auth builds, these message ids
// must not change unless all front-end servers are synchronously replaced.
enum {
kSrv2State_SaveObject = 0,
kSrv2State_DeleteObject = 1,
kSrv2State_FetchObject = 2,
};
enum {
kState2Srv_ObjectFetched = 0,
};
//============================================================================
// BEGIN PACKED DATA STRUCTURES
//============================================================================
#include <PshPack1.h>
/*****************************************************************************
*
* Srv2State connect packet
*
***/
struct Srv2State_ConnData {
dword dataBytes;
dword buildId;
dword srvType;
};
struct Srv2State_Connect {
AsyncSocketConnectPacket hdr;
Srv2State_ConnData data;
};
/*****************************************************************************
*
* Srv2State message structures
*
***/
struct Srv2State_FetchObject : SrvMsgHeader {
Uuid ownerId;
wchar objectName[kMaxStateObjectName];
};
struct Srv2State_SaveObject : SrvMsgHeader {
Uuid ownerId;
wchar objectName[kMaxStateObjectName];
dword objectDataBytes;
byte objectData[1]; // objectData[objectDataBytes], actually
// no more fields after var length alloc
};
struct Srv2State_DeleteObject : SrvMsgHeader {
Uuid ownerId;
wchar objectName[kMaxStateObjectName];
};
/*****************************************************************************
*
* State2Srv message structures
*
***/
struct State2Srv_ObjectFetched : SrvMsgHeader {
dword objectDataBytes;
byte objectData[1];
// no more fields after var length alloc
};
//============================================================================
// END PACKED DATA STRUCTURES
//============================================================================
#include <PopPack.h>
/*****************************************************************************
*
* Srv2State functions
*
***/
bool Srv2StateValidateConnect (
AsyncNotifySocketListen * listen,
Srv2State_ConnData * connectPtr
);
/*==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/pnNetProtocol/Private/Protocols/Srv2State/pnNpSrv2State.h
*
***/
#ifdef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETPROTOCOL_PRIVATE_PROTOCOLS_SRV2STATE_PNNPSRV2STATE_H
#error "Header $/Plasma20/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2State/pnNpSrv2State.h included more than once"
#endif
#define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETPROTOCOL_PRIVATE_PROTOCOLS_SRV2STATE_PNNPSRV2STATE_H
// kNetProtocolSrv2State messages
// Because SrvState must remain compatible with older auth builds, these message ids
// must not change unless all front-end servers are synchronously replaced.
enum {
kSrv2State_SaveObject = 0,
kSrv2State_DeleteObject = 1,
kSrv2State_FetchObject = 2,
};
enum {
kState2Srv_ObjectFetched = 0,
};
//============================================================================
// BEGIN PACKED DATA STRUCTURES
//============================================================================
#include <PshPack1.h>
/*****************************************************************************
*
* Srv2State connect packet
*
***/
struct Srv2State_ConnData {
dword dataBytes;
dword buildId;
dword srvType;
};
struct Srv2State_Connect {
AsyncSocketConnectPacket hdr;
Srv2State_ConnData data;
};
/*****************************************************************************
*
* Srv2State message structures
*
***/
struct Srv2State_FetchObject : SrvMsgHeader {
Uuid ownerId;
wchar objectName[kMaxStateObjectName];
};
struct Srv2State_SaveObject : SrvMsgHeader {
Uuid ownerId;
wchar objectName[kMaxStateObjectName];
dword objectDataBytes;
byte objectData[1]; // objectData[objectDataBytes], actually
// no more fields after var length alloc
};
struct Srv2State_DeleteObject : SrvMsgHeader {
Uuid ownerId;
wchar objectName[kMaxStateObjectName];
};
/*****************************************************************************
*
* State2Srv message structures
*
***/
struct State2Srv_ObjectFetched : SrvMsgHeader {
dword objectDataBytes;
byte objectData[1];
// no more fields after var length alloc
};
//============================================================================
// END PACKED DATA STRUCTURES
//============================================================================
#include <PopPack.h>
/*****************************************************************************
*
* Srv2State functions
*
***/
bool Srv2StateValidateConnect (
AsyncNotifySocketListen * listen,
Srv2State_ConnData * connectPtr
);

View File

@ -1,71 +1,71 @@
/*==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/pnNetProtocol/Private/Protocols/Srv2Vault/pnNpSrv2Vault.cpp
*
***/
#ifdef SERVER
#define USES_PROTOCOL_SRV2VAULT
#include "../../../Pch.h"
#pragma hdrstop
/*****************************************************************************
*
* Exports
*
***/
//===========================================================================
bool Srv2VaultValidateConnect (
AsyncNotifySocketListen * listen,
Srv2Vault_ConnData * connectPtr
) {
// Ensure that there are enough bytes for the header
const Srv2Vault_ConnData & connect = * (const Srv2Vault_ConnData *) listen->buffer;
// Validate message size
const unsigned kMinStructSize = sizeof(dword) * 3;
if (listen->bytes < kMinStructSize)
return false;
if (listen->bytes < connect.dataBytes)
return false;
// Validate connect server type
if (!(connect.srvType == kSrvTypeAuth || connect.srvType == kSrvTypeGame || connect.srvType == kSrvTypeMcp))
return false;
ZEROPTR(connectPtr);
MemCopy(connectPtr, &connect, min(sizeof(*connectPtr), connect.dataBytes));
listen->bytesProcessed += connect.dataBytes;
return true;
}
#endif // SERVER
/*==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/pnNetProtocol/Private/Protocols/Srv2Vault/pnNpSrv2Vault.cpp
*
***/
#ifdef SERVER
#define USES_PROTOCOL_SRV2VAULT
#include "../../../Pch.h"
#pragma hdrstop
/*****************************************************************************
*
* Exports
*
***/
//===========================================================================
bool Srv2VaultValidateConnect (
AsyncNotifySocketListen * listen,
Srv2Vault_ConnData * connectPtr
) {
// Ensure that there are enough bytes for the header
const Srv2Vault_ConnData & connect = * (const Srv2Vault_ConnData *) listen->buffer;
// Validate message size
const unsigned kMinStructSize = sizeof(dword) * 3;
if (listen->bytes < kMinStructSize)
return false;
if (listen->bytes < connect.dataBytes)
return false;
// Validate connect server type
if (!(connect.srvType == kSrvTypeAuth || connect.srvType == kSrvTypeGame || connect.srvType == kSrvTypeMcp))
return false;
ZEROPTR(connectPtr);
MemCopy(connectPtr, &connect, min(sizeof(*connectPtr), connect.dataBytes));
listen->bytesProcessed += connect.dataBytes;
return true;
}
#endif // SERVER

View File

@ -1,452 +1,452 @@
/*==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/pnNetProtocol/Private/Protocols/Srv2Vault/pnNpSrv2Vault.h
*
***/
#ifdef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETPROTOCOL_PRIVATE_PROTOCOLS_SRV2VAULT_PNNPSRV2VAULT_H
#error "Header $/Plasma20/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Vault/pnNpSrv2Vault.h included more than once"
#endif
#define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETPROTOCOL_PRIVATE_PROTOCOLS_SRV2VAULT_PNNPSRV2VAULT_H
// kNetProtocolSrv2Db messages
// Because SrvVault must remain compatible with older auth builds, these message ids
// must not change unless all front-end servers are synchronously replaced.
enum {
// Player creation
kSrv2Vault_PlayerCreateRequest = 0,
kSrv2Vault_PlayerDeleteRequest = 1,
kSrv2Vault_UpgradeVisitorRequest = 2,
kSrv2Vault_ChangePlayerNameRequest = 3,
// Account
kSrv2Vault_AccountLoginRequest = 20,
kSrv2Vault_AccountLogout = 21,
// NodeRefs
kSrv2Vault_FetchChildNodeRefs = 40,
kSrv2Vault_NodeAdd = 41,
kSrv2Vault_NodeRemove = 42,
kSrv2Vault_NodeAdd2 = 43,
kSrv2Vault_NodeRemove2 = 44,
// Nodes
kSrv2Vault_NodeFetch = 60,
kSrv2Vault_CreateNodeRequest = 61,
kSrv2Vault_NodeSave = 62,
kSrv2Vault_DeleteNodeRequest = 63,
kSrv2Vault_NodeFindRequest = 64,
kSrv2Vault_SendNode = 65,
kSrv2Vault_NodeSave2 = 66,
// Notification targets
kSrv2Vault_RegisterPlayerVault = 80,
kSrv2Vault_UnregisterPlayerVault = 81,
kSrv2Vault_RegisterAgeVault = 82,
kSrv2Vault_UnregisterAgeVault = 83,
kSrv2Vault_AgeInitRequest = 84,
// Public ages
kSrv2Vault_GetPublicAgeList = 100,
kSrv2Vault_SetAgePublic = 101,
kSrv2Vault_CurrentPopulationReply = 102,
// MCP Notifications
kSrv2Vault_AccountOnline = 140,
kSrv2Vault_AccountOffline = 141,
kSrv2Vault_PlayerOnline = 142,
kSrv2Vault_PlayerOffline = 143,
kSrv2Vault_AgeOnline = 144,
kSrv2Vault_AgeOffline = 145,
kSrv2Vault_PlayerJoinedAge = 146,
kSrv2Vault_PlayerLeftAge = 147,
};
enum {
// Player creation
kVault2Srv_PlayerCreateReply = 0,
kVault2Srv_PlayerDeleteReply = 1,
kVault2Srv_UpgradeVisitorReply = 2,
kVault2Srv_ChangePlayerNameReply = 3,
// Account
kVault2Srv_AccountLoginReply = 20,
// NodeRefs
kVault2Srv_NodeRefsFetched = 40,
// Nodes
kVault2Srv_NodeFetched = 60,
kVault2Srv_NodeCreated = 61,
kVault2Srv_NodeFindReply = 62,
// Notification
kVault2Srv_NodeChanged = 80,
kVault2Srv_NodeAdded = 81,
kVault2Srv_NodeRemoved = 82,
kVault2Srv_NodeDeleted = 83,
// Notification targets
kVault2Srv_AgeInitReply = 102,
// Public ages
kVault2Srv_PublicAgeList = 120,
kVault2Srv_CurrentPopulationRequest = 121,
// AgeSDL
kVault2Srv_NotifyAgeSDLChanged = 140,
};
//============================================================================
// BEGIN PACKED DATA STRUCTURES
//============================================================================
#include <PshPack1.h>
/*****************************************************************************
*
* Srv2Vault connect packet
*
***/
struct Srv2Vault_ConnData {
dword dataBytes;
dword buildId;
dword srvType;
};
struct Srv2Vault_Connect {
AsyncSocketConnectPacket hdr;
Srv2Vault_ConnData data;
};
/*****************************************************************************
*
* Srv2Vault packets
*
***/
struct Srv2Vault_PlayerCreateRequest : SrvMsgHeader {
Uuid accountUuid;
wchar playerName[kMaxPlayerNameLength];
wchar avatarShape[MAX_PATH];
wchar friendInvite[MAX_PATH];
byte explorer;
};
struct Srv2Vault_PlayerDeleteRequest : SrvMsgHeader {
Uuid accountId;
dword playerId;
};
struct Srv2Vault_UpgradeVisitorRequest : SrvMsgHeader {
Uuid accountId;
dword playerId;
};
struct Srv2Vault_AccountLoginRequest : SrvMsgHeader {
Uuid accountUuid;
};
struct Srv2Vault_AccountLogout : SrvMsgHeader {
Uuid accountUuid;
};
struct Srv2Vault_FetchChildNodeRefs : SrvMsgHeader {
dword parentId;
dword maxDepth;
};
struct Srv2Vault_NodeFetch : SrvMsgHeader {
dword nodeId;
};
struct Srv2Vault_CreateNodeRequest : SrvMsgHeader {
Uuid accountId;
dword creatorId;
dword nodeBytes;
byte nodeBuffer[1];
};
struct Srv2Vault_DeleteNodeRequest : SrvMsgHeader {
dword nodeId;
unsigned playerCheckId;
unsigned isRequestFromAuth;
};
struct Srv2Vault_NodeSave : SrvMsgHeader {
dword nodeId;
unsigned playerCheckId;
unsigned isRequestFromAuth;
Uuid revisionId;
dword nodeBytes;
byte nodeBuffer[1];
};
struct Srv2Vault_NodeSave2 : SrvMsgHeader {
dword nodeId;
unsigned playerCheckId;
unsigned isRequestFromAuth;
Uuid revisionId;
dword nodeBytes;
byte nodeBuffer[1];
};
struct Srv2Vault_NodeAdd : SrvMsgHeader {
NetVaultNodeRef ref;
};
struct Srv2Vault_NodeAdd2 : SrvMsgHeader {
NetVaultNodeRef ref;
};
struct Srv2Vault_NodeRemove : SrvMsgHeader {
dword parentId;
dword childId;
unsigned playerCheckId;
unsigned isRequestFromAuth;
};
struct Srv2Vault_NodeRemove2 : SrvMsgHeader {
dword parentId;
dword childId;
unsigned playerCheckId;
unsigned isRequestFromAuth;
};
struct Srv2Vault_NodeFindRequest : SrvMsgHeader {
// Template node to match
dword nodeBytes;
byte nodeBuffer[1]; // [nodeBytes], actually
// no more fields after var length alloc
};
struct Srv2Vault_SendNode : SrvMsgHeader {
dword srcPlayerId; // sender
dword srcNodeId; // sent item
dword dstPlayerId; // recipient
};
struct Srv2Vault_RegisterPlayerVault : SrvMsgHeader {
Uuid accountId;
dword playerId;
};
struct Srv2Vault_UnregisterPlayerVault : SrvMsgHeader {
Uuid accountId;
};
struct Srv2Vault_RegisterAgeVault : SrvMsgHeader {
Uuid accountId;
dword ageId; // age's vault node id
};
struct Srv2Vault_UnregisterAgeVault : SrvMsgHeader {
Uuid accountId;
};
struct Srv2Vault_AgeInitRequest : SrvMsgHeader {
Uuid accountId;
dword playerId;
Uuid ageInstId;
Uuid parentAgeInstId;
dword ageLanguage;
dword ageSequenceNumber;
// packed fields:
// wchar ageFilename[]
// wchar ageInstName[]
// wchar ageUserName[]
// wchar ageDesc[]
};
struct Srv2Vault_GetPublicAgeList : SrvMsgHeader {
wchar ageName[kMaxAgeNameLength];
};
struct Srv2Vault_SetAgePublic : SrvMsgHeader {
dword playerId;
dword ageInfoId;
byte publicOrNot;
};
struct Srv2Vault_CurrentPopulationReply : SrvMsgHeader {
dword ageCount;
unsigned agePopulations[1]; // [ageCount], actually
// no more fields after var length alloc
};
struct Srv2Vault_ChangePlayerNameRequest : SrvMsgHeader {
Uuid accountId;
dword playerId;
wchar newName[kMaxPlayerNameLength];
};
struct Srv2Vault_AccountOnline : SrvMsgHeader {
Uuid acctId;
dword buildId;
dword authNode;
};
struct Srv2Vault_AccountOffline : SrvMsgHeader {
Uuid acctId;
dword buildId;
};
struct Srv2Vault_PlayerOnline : SrvMsgHeader {
Uuid acctId;
dword buildId;
dword playerId;
};
struct Srv2Vault_PlayerOffline : SrvMsgHeader {
dword playerId;
dword buildId;
};
struct Srv2Vault_AgeOnline : SrvMsgHeader {
Uuid ageInstId;
dword buildId;
dword gameNode;
};
struct Srv2Vault_AgeOffline : SrvMsgHeader {
Uuid ageInstId;
dword buildId;
};
struct Srv2Vault_PlayerJoinedAge : SrvMsgHeader {
dword playerId;
Uuid ageInstId;
dword buildId;
};
struct Srv2Vault_PlayerLeftAge : SrvMsgHeader {
dword playerId;
dword buildId;
};
/*****************************************************************************
*
* Vault2Srv packets
*
***/
struct Vault2Srv_PlayerCreateReply : SrvMsgHeader {
dword playerId;
};
struct Vault2Srv_AccountLoginReply : SrvMsgHeader {
dword playerInfoCount;
SrvPlayerInfo playerInfos[1];
};
struct Vault2Srv_NodeRefsFetched : SrvMsgHeader {
dword refCount;
NetVaultNodeRef refs[1];
};
struct Vault2Srv_NodeFetched : SrvMsgHeader {
dword nodeBytes;
byte nodeBuffer[1];
};
struct Vault2Srv_NodeCreated : SrvMsgHeader {
dword nodeId;
};
struct Vault2Srv_NodeChanged : SrvMsgHeader {
dword nodeId;
Uuid revisionId;
Uuid accountId; // the notify target
};
struct Vault2Srv_NodeAdded : SrvMsgHeader {
NetVaultNodeRef ref;
Uuid accountId; // the notify target
};
struct Vault2Srv_NodeRemoved : SrvMsgHeader {
dword parentId;
dword childId;
Uuid accountId; // the notify target
};
struct Vault2Srv_NodeDeleted : SrvMsgHeader {
dword nodeId;
Uuid accountId; // the notify target
};
struct Vault2Srv_NodeFindReply : SrvMsgHeader {
// out: ids of matching nodes
dword nodeIdCount;
dword nodeIds[1]; // [nodeIdCount], actually
// no more fields after var length alloc
};
struct Vault2Srv_AgeInitReply : SrvMsgHeader {
dword ageNodeId;
dword ageInfoNodeId;
Uuid accountId; // the requestor
};
struct Vault2Srv_PublicAgeList : SrvMsgHeader {
dword ageCount;
NetAgeInfo ages[1]; // [ageCount], actually
// no more fields after var length alloc
};
struct Vault2Srv_NotifyAgeSDLChanged : SrvMsgHeader {
wchar ageName[kMaxAgeNameLength];
Uuid ageInstId;
};
struct Vault2Srv_CurrentPopulationRequest : SrvMsgHeader {
dword ageCount;
Uuid ageInstIds[1]; // [ageCount], actually
// no more fields after var length alloc
};
//============================================================================
// END PACKED DATA STRUCTURES
//============================================================================
#include <PopPack.h>
/*****************************************************************************
*
* Srv2Vault functions
*
***/
bool Srv2VaultValidateConnect (
AsyncNotifySocketListen * listen,
Srv2Vault_ConnData * connectPtr
);
/*==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/pnNetProtocol/Private/Protocols/Srv2Vault/pnNpSrv2Vault.h
*
***/
#ifdef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETPROTOCOL_PRIVATE_PROTOCOLS_SRV2VAULT_PNNPSRV2VAULT_H
#error "Header $/Plasma20/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Vault/pnNpSrv2Vault.h included more than once"
#endif
#define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETPROTOCOL_PRIVATE_PROTOCOLS_SRV2VAULT_PNNPSRV2VAULT_H
// kNetProtocolSrv2Db messages
// Because SrvVault must remain compatible with older auth builds, these message ids
// must not change unless all front-end servers are synchronously replaced.
enum {
// Player creation
kSrv2Vault_PlayerCreateRequest = 0,
kSrv2Vault_PlayerDeleteRequest = 1,
kSrv2Vault_UpgradeVisitorRequest = 2,
kSrv2Vault_ChangePlayerNameRequest = 3,
// Account
kSrv2Vault_AccountLoginRequest = 20,
kSrv2Vault_AccountLogout = 21,
// NodeRefs
kSrv2Vault_FetchChildNodeRefs = 40,
kSrv2Vault_NodeAdd = 41,
kSrv2Vault_NodeRemove = 42,
kSrv2Vault_NodeAdd2 = 43,
kSrv2Vault_NodeRemove2 = 44,
// Nodes
kSrv2Vault_NodeFetch = 60,
kSrv2Vault_CreateNodeRequest = 61,
kSrv2Vault_NodeSave = 62,
kSrv2Vault_DeleteNodeRequest = 63,
kSrv2Vault_NodeFindRequest = 64,
kSrv2Vault_SendNode = 65,
kSrv2Vault_NodeSave2 = 66,
// Notification targets
kSrv2Vault_RegisterPlayerVault = 80,
kSrv2Vault_UnregisterPlayerVault = 81,
kSrv2Vault_RegisterAgeVault = 82,
kSrv2Vault_UnregisterAgeVault = 83,
kSrv2Vault_AgeInitRequest = 84,
// Public ages
kSrv2Vault_GetPublicAgeList = 100,
kSrv2Vault_SetAgePublic = 101,
kSrv2Vault_CurrentPopulationReply = 102,
// MCP Notifications
kSrv2Vault_AccountOnline = 140,
kSrv2Vault_AccountOffline = 141,
kSrv2Vault_PlayerOnline = 142,
kSrv2Vault_PlayerOffline = 143,
kSrv2Vault_AgeOnline = 144,
kSrv2Vault_AgeOffline = 145,
kSrv2Vault_PlayerJoinedAge = 146,
kSrv2Vault_PlayerLeftAge = 147,
};
enum {
// Player creation
kVault2Srv_PlayerCreateReply = 0,
kVault2Srv_PlayerDeleteReply = 1,
kVault2Srv_UpgradeVisitorReply = 2,
kVault2Srv_ChangePlayerNameReply = 3,
// Account
kVault2Srv_AccountLoginReply = 20,
// NodeRefs
kVault2Srv_NodeRefsFetched = 40,
// Nodes
kVault2Srv_NodeFetched = 60,
kVault2Srv_NodeCreated = 61,
kVault2Srv_NodeFindReply = 62,
// Notification
kVault2Srv_NodeChanged = 80,
kVault2Srv_NodeAdded = 81,
kVault2Srv_NodeRemoved = 82,
kVault2Srv_NodeDeleted = 83,
// Notification targets
kVault2Srv_AgeInitReply = 102,
// Public ages
kVault2Srv_PublicAgeList = 120,
kVault2Srv_CurrentPopulationRequest = 121,
// AgeSDL
kVault2Srv_NotifyAgeSDLChanged = 140,
};
//============================================================================
// BEGIN PACKED DATA STRUCTURES
//============================================================================
#include <PshPack1.h>
/*****************************************************************************
*
* Srv2Vault connect packet
*
***/
struct Srv2Vault_ConnData {
dword dataBytes;
dword buildId;
dword srvType;
};
struct Srv2Vault_Connect {
AsyncSocketConnectPacket hdr;
Srv2Vault_ConnData data;
};
/*****************************************************************************
*
* Srv2Vault packets
*
***/
struct Srv2Vault_PlayerCreateRequest : SrvMsgHeader {
Uuid accountUuid;
wchar playerName[kMaxPlayerNameLength];
wchar avatarShape[MAX_PATH];
wchar friendInvite[MAX_PATH];
byte explorer;
};
struct Srv2Vault_PlayerDeleteRequest : SrvMsgHeader {
Uuid accountId;
dword playerId;
};
struct Srv2Vault_UpgradeVisitorRequest : SrvMsgHeader {
Uuid accountId;
dword playerId;
};
struct Srv2Vault_AccountLoginRequest : SrvMsgHeader {
Uuid accountUuid;
};
struct Srv2Vault_AccountLogout : SrvMsgHeader {
Uuid accountUuid;
};
struct Srv2Vault_FetchChildNodeRefs : SrvMsgHeader {
dword parentId;
dword maxDepth;
};
struct Srv2Vault_NodeFetch : SrvMsgHeader {
dword nodeId;
};
struct Srv2Vault_CreateNodeRequest : SrvMsgHeader {
Uuid accountId;
dword creatorId;
dword nodeBytes;
byte nodeBuffer[1];
};
struct Srv2Vault_DeleteNodeRequest : SrvMsgHeader {
dword nodeId;
unsigned playerCheckId;
unsigned isRequestFromAuth;
};
struct Srv2Vault_NodeSave : SrvMsgHeader {
dword nodeId;
unsigned playerCheckId;
unsigned isRequestFromAuth;
Uuid revisionId;
dword nodeBytes;
byte nodeBuffer[1];
};
struct Srv2Vault_NodeSave2 : SrvMsgHeader {
dword nodeId;
unsigned playerCheckId;
unsigned isRequestFromAuth;
Uuid revisionId;
dword nodeBytes;
byte nodeBuffer[1];
};
struct Srv2Vault_NodeAdd : SrvMsgHeader {
NetVaultNodeRef ref;
};
struct Srv2Vault_NodeAdd2 : SrvMsgHeader {
NetVaultNodeRef ref;
};
struct Srv2Vault_NodeRemove : SrvMsgHeader {
dword parentId;
dword childId;
unsigned playerCheckId;
unsigned isRequestFromAuth;
};
struct Srv2Vault_NodeRemove2 : SrvMsgHeader {
dword parentId;
dword childId;
unsigned playerCheckId;
unsigned isRequestFromAuth;
};
struct Srv2Vault_NodeFindRequest : SrvMsgHeader {
// Template node to match
dword nodeBytes;
byte nodeBuffer[1]; // [nodeBytes], actually
// no more fields after var length alloc
};
struct Srv2Vault_SendNode : SrvMsgHeader {
dword srcPlayerId; // sender
dword srcNodeId; // sent item
dword dstPlayerId; // recipient
};
struct Srv2Vault_RegisterPlayerVault : SrvMsgHeader {
Uuid accountId;
dword playerId;
};
struct Srv2Vault_UnregisterPlayerVault : SrvMsgHeader {
Uuid accountId;
};
struct Srv2Vault_RegisterAgeVault : SrvMsgHeader {
Uuid accountId;
dword ageId; // age's vault node id
};
struct Srv2Vault_UnregisterAgeVault : SrvMsgHeader {
Uuid accountId;
};
struct Srv2Vault_AgeInitRequest : SrvMsgHeader {
Uuid accountId;
dword playerId;
Uuid ageInstId;
Uuid parentAgeInstId;
dword ageLanguage;
dword ageSequenceNumber;
// packed fields:
// wchar ageFilename[]
// wchar ageInstName[]
// wchar ageUserName[]
// wchar ageDesc[]
};
struct Srv2Vault_GetPublicAgeList : SrvMsgHeader {
wchar ageName[kMaxAgeNameLength];
};
struct Srv2Vault_SetAgePublic : SrvMsgHeader {
dword playerId;
dword ageInfoId;
byte publicOrNot;
};
struct Srv2Vault_CurrentPopulationReply : SrvMsgHeader {
dword ageCount;
unsigned agePopulations[1]; // [ageCount], actually
// no more fields after var length alloc
};
struct Srv2Vault_ChangePlayerNameRequest : SrvMsgHeader {
Uuid accountId;
dword playerId;
wchar newName[kMaxPlayerNameLength];
};
struct Srv2Vault_AccountOnline : SrvMsgHeader {
Uuid acctId;
dword buildId;
dword authNode;
};
struct Srv2Vault_AccountOffline : SrvMsgHeader {
Uuid acctId;
dword buildId;
};
struct Srv2Vault_PlayerOnline : SrvMsgHeader {
Uuid acctId;
dword buildId;
dword playerId;
};
struct Srv2Vault_PlayerOffline : SrvMsgHeader {
dword playerId;
dword buildId;
};
struct Srv2Vault_AgeOnline : SrvMsgHeader {
Uuid ageInstId;
dword buildId;
dword gameNode;
};
struct Srv2Vault_AgeOffline : SrvMsgHeader {
Uuid ageInstId;
dword buildId;
};
struct Srv2Vault_PlayerJoinedAge : SrvMsgHeader {
dword playerId;
Uuid ageInstId;
dword buildId;
};
struct Srv2Vault_PlayerLeftAge : SrvMsgHeader {
dword playerId;
dword buildId;
};
/*****************************************************************************
*
* Vault2Srv packets
*
***/
struct Vault2Srv_PlayerCreateReply : SrvMsgHeader {
dword playerId;
};
struct Vault2Srv_AccountLoginReply : SrvMsgHeader {
dword playerInfoCount;
SrvPlayerInfo playerInfos[1];
};
struct Vault2Srv_NodeRefsFetched : SrvMsgHeader {
dword refCount;
NetVaultNodeRef refs[1];
};
struct Vault2Srv_NodeFetched : SrvMsgHeader {
dword nodeBytes;
byte nodeBuffer[1];
};
struct Vault2Srv_NodeCreated : SrvMsgHeader {
dword nodeId;
};
struct Vault2Srv_NodeChanged : SrvMsgHeader {
dword nodeId;
Uuid revisionId;
Uuid accountId; // the notify target
};
struct Vault2Srv_NodeAdded : SrvMsgHeader {
NetVaultNodeRef ref;
Uuid accountId; // the notify target
};
struct Vault2Srv_NodeRemoved : SrvMsgHeader {
dword parentId;
dword childId;
Uuid accountId; // the notify target
};
struct Vault2Srv_NodeDeleted : SrvMsgHeader {
dword nodeId;
Uuid accountId; // the notify target
};
struct Vault2Srv_NodeFindReply : SrvMsgHeader {
// out: ids of matching nodes
dword nodeIdCount;
dword nodeIds[1]; // [nodeIdCount], actually
// no more fields after var length alloc
};
struct Vault2Srv_AgeInitReply : SrvMsgHeader {
dword ageNodeId;
dword ageInfoNodeId;
Uuid accountId; // the requestor
};
struct Vault2Srv_PublicAgeList : SrvMsgHeader {
dword ageCount;
NetAgeInfo ages[1]; // [ageCount], actually
// no more fields after var length alloc
};
struct Vault2Srv_NotifyAgeSDLChanged : SrvMsgHeader {
wchar ageName[kMaxAgeNameLength];
Uuid ageInstId;
};
struct Vault2Srv_CurrentPopulationRequest : SrvMsgHeader {
dword ageCount;
Uuid ageInstIds[1]; // [ageCount], actually
// no more fields after var length alloc
};
//============================================================================
// END PACKED DATA STRUCTURES
//============================================================================
#include <PopPack.h>
/*****************************************************************************
*
* Srv2Vault functions
*
***/
bool Srv2VaultValidateConnect (
AsyncNotifySocketListen * listen,
Srv2Vault_ConnData * connectPtr
);

View File

@ -1,104 +1,104 @@
/*==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/pnNetProtocol/Private/pnNpAllIncludes.h
*
***/
#ifdef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETPROTOCOL_PRIVATE_PNNPALLINCLUDES_H
#error "Header $/Plasma20/Sources/Plasma/NucleusLib/pnNetProtocol/Private/pnNpAllIncludes.h included more than once"
#endif
#define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETPROTOCOL_PRIVATE_PNNPALLINCLUDES_H
#if defined(USES_PROTOCOL_CLI2AUTH) || defined(USES_PROTOCOL_CLI2GAME) || defined(USES_PROTOCOL_CLI2CSR) || defined(USES_PROTOCOL_CLI2GATEKEEPER)
# define USES_NETCLI
#endif
#if defined(USES_PROTOCOL_SRV2VAULT) || defined(USES_PROTOCOL_SRV2DB) || defined(USES_PROTOCOL_SRV2MCP) || defined(USES_PROTOCOL_SRV2STATE) || defined(USES_PROTOCOL_SRV2LOG) || defined(USES_PROTOCOL_SRV2SCORE)
# define USES_NETSRV
#endif
#include "pnNpCommon.h"
#ifdef USES_PROTOCOL_CLI2FILE
# include "Protocols/Cli2File/pnNpCli2File.h"
#endif
#ifdef USES_NETCLI
# ifdef USES_PROTOCOL_CLI2AUTH
# include "Protocols/Cli2Auth/pnNpCli2Auth.h"
# endif
# ifdef USES_PROTOCOL_CLI2GAME
# include "Protocols/Cli2Game/pnNpCli2Game.h"
# endif
# ifdef USES_PROTOCOL_CLI2CSR
# include "Protocols/Cli2Csr/pnNpCli2Csr.h"
# endif
# ifdef USES_PROTOCOL_CLI2GATEKEEPER
# include "Protocols/Cli2GateKeeper/pnNpCli2GateKeeper.h"
# endif
#endif // def USES_NETCLI
#ifdef SERVER
# ifdef USES_NETSRV
// for SrvMsgHeader definition
# include "pnIni/pnIni.h" // psSrvConn needs ini types
# include "psUtils/psUtils.h"
# ifdef USES_PROTOCOL_SRV2VAULT
# include "Protocols/Srv2Vault/pnNpSrv2Vault.h"
# endif
# ifdef USES_PROTOCOL_SRV2DB
# include "Protocols/Srv2Db/pnNpSrv2Db.h"
# endif
# ifdef USES_PROTOCOL_SRV2MCP
# include "Protocols/Srv2Mcp/pnNpSrv2Mcp.h"
# endif
# ifdef USES_PROTOCOL_SRV2STATE
# include "Protocols/Srv2State/pnNpSrv2State.h"
# endif
# ifdef USES_PROTOCOL_SRV2SCORE
# include "Protocols/Srv2Score/pnNpSrv2Score.h"
# endif
# ifdef USES_PROTOCOL_SRV2LOG
# include "Protocols/Srv2Log/pnNpSrv2Log.h"
# endif
# endif // def USES_NETSRV
#endif // def SERVER
/*==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/pnNetProtocol/Private/pnNpAllIncludes.h
*
***/
#ifdef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETPROTOCOL_PRIVATE_PNNPALLINCLUDES_H
#error "Header $/Plasma20/Sources/Plasma/NucleusLib/pnNetProtocol/Private/pnNpAllIncludes.h included more than once"
#endif
#define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETPROTOCOL_PRIVATE_PNNPALLINCLUDES_H
#if defined(USES_PROTOCOL_CLI2AUTH) || defined(USES_PROTOCOL_CLI2GAME) || defined(USES_PROTOCOL_CLI2CSR) || defined(USES_PROTOCOL_CLI2GATEKEEPER)
# define USES_NETCLI
#endif
#if defined(USES_PROTOCOL_SRV2VAULT) || defined(USES_PROTOCOL_SRV2DB) || defined(USES_PROTOCOL_SRV2MCP) || defined(USES_PROTOCOL_SRV2STATE) || defined(USES_PROTOCOL_SRV2LOG) || defined(USES_PROTOCOL_SRV2SCORE)
# define USES_NETSRV
#endif
#include "pnNpCommon.h"
#ifdef USES_PROTOCOL_CLI2FILE
# include "Protocols/Cli2File/pnNpCli2File.h"
#endif
#ifdef USES_NETCLI
# ifdef USES_PROTOCOL_CLI2AUTH
# include "Protocols/Cli2Auth/pnNpCli2Auth.h"
# endif
# ifdef USES_PROTOCOL_CLI2GAME
# include "Protocols/Cli2Game/pnNpCli2Game.h"
# endif
# ifdef USES_PROTOCOL_CLI2CSR
# include "Protocols/Cli2Csr/pnNpCli2Csr.h"
# endif
# ifdef USES_PROTOCOL_CLI2GATEKEEPER
# include "Protocols/Cli2GateKeeper/pnNpCli2GateKeeper.h"
# endif
#endif // def USES_NETCLI
#ifdef SERVER
# ifdef USES_NETSRV
// for SrvMsgHeader definition
# include "pnIni/pnIni.h" // psSrvConn needs ini types
# include "psUtils/psUtils.h"
# ifdef USES_PROTOCOL_SRV2VAULT
# include "Protocols/Srv2Vault/pnNpSrv2Vault.h"
# endif
# ifdef USES_PROTOCOL_SRV2DB
# include "Protocols/Srv2Db/pnNpSrv2Db.h"
# endif
# ifdef USES_PROTOCOL_SRV2MCP
# include "Protocols/Srv2Mcp/pnNpSrv2Mcp.h"
# endif
# ifdef USES_PROTOCOL_SRV2STATE
# include "Protocols/Srv2State/pnNpSrv2State.h"
# endif
# ifdef USES_PROTOCOL_SRV2SCORE
# include "Protocols/Srv2Score/pnNpSrv2Score.h"
# endif
# ifdef USES_PROTOCOL_SRV2LOG
# include "Protocols/Srv2Log/pnNpSrv2Log.h"
# endif
# endif // def USES_NETSRV
#endif // def SERVER

File diff suppressed because it is too large Load Diff

View File

@ -1,483 +1,483 @@
/*==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/pnNetProtocol/Private/pnNpCommon.h
*
***/
#ifdef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETPROTOCOL_PRIVATE_PNNPCOMMON_H
#error "Header $/Plasma20/Sources/Plasma/NucleusLib/pnNetProtocol/Private/pnNpCommon.h included more than once"
#endif
#define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETPROTOCOL_PRIVATE_PNNPCOMMON_H
/*****************************************************************************
*
* Client message field types
*
***/
#ifdef USES_NETCLI
const NetMsgField kNetMsgFieldAccountName = NET_MSG_FIELD_STRING(kMaxAccountNameLength);
const NetMsgField kNetMsgFieldPlayerName = NET_MSG_FIELD_STRING(kMaxPlayerNameLength);
const NetMsgField kNetMsgFieldShaDigest = NET_MSG_FIELD_RAW_DATA(sizeof(ShaDigest));
const NetMsgField kNetMsgFieldUuid = NET_MSG_FIELD_DATA(sizeof(Uuid));
const NetMsgField kNetMsgFieldTransId = NET_MSG_FIELD_DWORD();
const NetMsgField kNetMsgFieldTimeMs = NET_MSG_FIELD_DWORD();
const NetMsgField kNetMsgFieldENetError = NET_MSG_FIELD_DWORD();
const NetMsgField kNetMsgFieldEAgeId = NET_MSG_FIELD_DWORD();
const NetMsgField kNetMsgFieldNetNode = NET_MSG_FIELD_DWORD();
const NetMsgField kNetMsgFieldBuildId = NET_MSG_FIELD_DWORD();
#endif
/*****************************************************************************
*
* Player information structures
*
***/
#include <PshPack1.h>
struct SrvPlayerInfo {
unsigned playerInt;
wchar playerName[kMaxPlayerNameLength];
wchar avatarShape[kMaxVaultNodeStringLength];
unsigned explorer;
};
#include <PopPack.h>
/*****************************************************************************
*
* NetAgeInfo
*
***/
struct NetAgeInfo {
Uuid ageInstId;
wchar ageFilename[kMaxAgeNameLength];
wchar ageInstName[kMaxAgeNameLength];
wchar ageUserName[kMaxAgeNameLength];
wchar ageDesc[1024];
dword ageSequenceNumber;
dword ageLanguage;
dword population; // only used with GetPublicAgeList query results
dword currentPopulation; // only used with GetPublicAgeList query results
};
/*****************************************************************************
*
* NetGameScore
*
***/
struct NetGameScore {
unsigned scoreId;
unsigned ownerId;
UInt32 createdTime;
wchar gameName[kMaxGameScoreNameLength];
unsigned gameType;
int value;
unsigned Read (const byte inbuffer[], unsigned bufsz, byte** end = nil); // returns number of bytes read
unsigned Write (ARRAY(byte) * buffer) const; // returns number of bytes written
void CopyFrom (const NetGameScore & score);
};
/*****************************************************************************
*
* NetGameRank
*
***/
struct NetGameRank {
unsigned rank;
int score;
wchar name[kMaxPlayerNameLength];
unsigned Read (const byte inbuffer[], unsigned bufsz, byte** end = nil); // returns number of bytes read
unsigned Write (ARRAY(byte) * buffer) const; // returns number of bytes written
void CopyFrom (const NetGameRank & fromRank);
};
/*****************************************************************************
*
* Server vault structures
*
***/
//============================================================================
// NetVaultNode
//============================================================================
// Threaded apps: App is responsible for locking node->critsect before accessing *any* field in this struct
struct NetVaultNode : AtomicRef {
enum RwOptions {
kRwDirtyOnly = 1<<0, // READ : No meaning
// WRITE: Only write fields marked dirty
kRwUpdateDirty = 1<<1, // READ : Set dirty flag on fields read from stream
// WRITE: Clear dirty flag on fields written to stream
};
enum CopyOptions {
kCopySetDirty = 1<<0, // set dirty flag on changed dst fields
kCopyOverwrite = 1<<1, // overwrite fields for which dst node already has values
kCopyClear = 1<<2, // clear dst fields for which src node does not have values
};
// These flag values must not change unless all servers are
// simultaneously replaced, so basically forget it.
static const qword kNodeId = (qword)1<< 0;
static const qword kCreateTime = (qword)1<< 1;
static const qword kModifyTime = (qword)1<< 2;
static const qword kCreateAgeName = (qword)1<< 3;
static const qword kCreateAgeUuid = (qword)1<< 4;
static const qword kCreatorAcct = (qword)1<< 5;
static const qword kCreatorId = (qword)1<< 6;
static const qword kNodeType = (qword)1<< 7;
static const qword kInt32_1 = (qword)1<< 8;
static const qword kInt32_2 = (qword)1<< 9;
static const qword kInt32_3 = (qword)1<<10;
static const qword kInt32_4 = (qword)1<<11;
static const qword kUInt32_1 = (qword)1<<12;
static const qword kUInt32_2 = (qword)1<<13;
static const qword kUInt32_3 = (qword)1<<14;
static const qword kUInt32_4 = (qword)1<<15;
static const qword kUuid_1 = (qword)1<<16;
static const qword kUuid_2 = (qword)1<<17;
static const qword kUuid_3 = (qword)1<<18;
static const qword kUuid_4 = (qword)1<<19;
static const qword kString64_1 = (qword)1<<20;
static const qword kString64_2 = (qword)1<<21;
static const qword kString64_3 = (qword)1<<22;
static const qword kString64_4 = (qword)1<<23;
static const qword kString64_5 = (qword)1<<24;
static const qword kString64_6 = (qword)1<<25;
static const qword kIString64_1 = (qword)1<<26;
static const qword kIString64_2 = (qword)1<<27;
// blobs always come last
static const qword kText_1 = (qword)1<<28;
static const qword kText_2 = (qword)1<<29;
static const qword kBlob_1 = (qword)1<<30;
static const qword kBlob_2 = (qword)1<<31;
CCritSect critsect;
qword fieldFlags;
qword dirtyFlags;
Uuid revisionId;
// Treat these as read-only or node flag fields will become invalid
// Threaded apps: Must be accessed with node->critsect locked
unsigned nodeId;
unsigned createTime;
unsigned modifyTime;
wchar * createAgeName;
Uuid createAgeUuid;
Uuid creatorAcct; // accountId of node creator
unsigned creatorId; // playerId of node creator
unsigned nodeType;
int int32_1;
int int32_2;
int int32_3;
int int32_4;
unsigned uint32_1;
unsigned uint32_2;
unsigned uint32_3;
unsigned uint32_4;
Uuid uuid_1;
Uuid uuid_2;
Uuid uuid_3;
Uuid uuid_4;
wchar * string64_1;
wchar * string64_2;
wchar * string64_3;
wchar * string64_4;
wchar * string64_5;
wchar * string64_6;
wchar * istring64_1;
wchar * istring64_2;
wchar * text_1;
wchar * text_2;
byte * blob_1; unsigned blob_1Length;
byte * blob_2; unsigned blob_2Length;
NetVaultNode ();
~NetVaultNode ();
// Threaded apps: Must be called with node->critsect locked
unsigned Read_LCS (const byte buffer[], unsigned bufsz, unsigned rwOpts); // returns number of bytes read
unsigned Write_LCS (ARRAY(byte) * buffer, unsigned rwOpts); // returns number of bytes written
bool Matches (const NetVaultNode * other);
void CopyFrom (const NetVaultNode * other, unsigned copyOpts);
// Threaded apps: Must be called with node->critsect locked
void SetNodeId (unsigned v);
void SetCreateTime (unsigned v);
void SetModifyTime (unsigned v);
void SetCreateAgeName (const wchar v[]);
void SetCreateAgeUuid (const Uuid & v);
void SetCreatorAcct (const Uuid & v);
void SetCreatorId (unsigned v);
void SetNodeType (unsigned v);
void SetInt32_1 (int v);
void SetInt32_2 (int v);
void SetInt32_3 (int v);
void SetInt32_4 (int v);
void SetUInt32_1 (unsigned v);
void SetUInt32_2 (unsigned v);
void SetUInt32_3 (unsigned v);
void SetUInt32_4 (unsigned v);
void SetUuid_1 (const Uuid & v);
void SetUuid_2 (const Uuid & v);
void SetUuid_3 (const Uuid & v);
void SetUuid_4 (const Uuid & v);
void SetString64_1 (const wchar v[]);
void SetString64_2 (const wchar v[]);
void SetString64_3 (const wchar v[]);
void SetString64_4 (const wchar v[]);
void SetString64_5 (const wchar v[]);
void SetString64_6 (const wchar v[]);
void SetIString64_1 (const wchar v[]);
void SetIString64_2 (const wchar v[]);
void SetText_1 (const wchar v[]);
void SetText_2 (const wchar v[]);
void SetBlob_1 (const byte v[], unsigned len);
void SetBlob_2 (const byte v[], unsigned len);
void SetText (qword fieldFlag, const wchar v[]);
void SetBlob (qword fieldFlag, const byte v[], unsigned len);
// These are only here to aid macro expansions (naming case matches field flags)
inline unsigned GetNodeId () const { return nodeId; }
inline unsigned GetCreateTime () const { return createTime; }
inline unsigned GetModifyTime () const { return modifyTime; }
inline wchar * GetCreateAgeName () const { return createAgeName; }
inline Uuid GetCreateAgeUuid () const { return createAgeUuid; }
inline Uuid GetCreatorAcct () const { return creatorAcct; }
inline unsigned GetCreatorId () const { return creatorId; }
inline unsigned GetNodeType () const { return nodeType; }
inline int GetInt32_1 () const { return int32_1; }
inline int GetInt32_2 () const { return int32_2; }
inline int GetInt32_3 () const { return int32_3; }
inline int GetInt32_4 () const { return int32_4; }
inline unsigned GetUInt32_1 () const { return uint32_1; }
inline unsigned GetUInt32_2 () const { return uint32_2; }
inline unsigned GetUInt32_3 () const { return uint32_3; }
inline unsigned GetUInt32_4 () const { return uint32_4; }
inline Uuid GetUuid_1 () const { return uuid_1; }
inline Uuid GetUuid_2 () const { return uuid_2; }
inline Uuid GetUuid_3 () const { return uuid_3; }
inline Uuid GetUuid_4 () const { return uuid_4; }
inline wchar * GetString64_1 () const { return string64_1; }
inline wchar * GetString64_2 () const { return string64_2; }
inline wchar * GetString64_3 () const { return string64_3; }
inline wchar * GetString64_4 () const { return string64_4; }
inline wchar * GetString64_5 () const { return string64_5; }
inline wchar * GetString64_6 () const { return string64_6; }
inline wchar * GetIString64_1 () const { return istring64_1; }
inline wchar * GetIString64_2 () const { return istring64_2; }
// no blob "getters"
};
//============================================================================
inline void IVaultNodeSetString (
qword bit,
NetVaultNode * node,
char ** pdst,
const char src[],
unsigned chars
) {
FREE(*pdst);
if (src && src[0])
*pdst = StrDupLen(src, chars);
else
*pdst = StrDupLen("", chars);
node->fieldFlags |= bit;
node->dirtyFlags |= bit;
}
//============================================================================
inline void IVaultNodeSetString (
qword bit,
NetVaultNode * node,
wchar ** pdst,
const wchar src[],
unsigned chars
) {
FREE(*pdst);
if (src && src[0])
*pdst = StrDupLen(src, chars);
else
*pdst = StrDupLen(L"", chars);
node->fieldFlags |= bit;
node->dirtyFlags |= bit;
}
//============================================================================
template <typename T>
inline void IVaultNodeSetValue (
qword bit,
NetVaultNode * node,
T * pdst,
const T & src
) {
*pdst = src;
node->fieldFlags |= bit;
node->dirtyFlags |= bit;
}
//============================================================================
inline void IVaultNodeSetBlob (
qword bit,
NetVaultNode * node,
byte ** pdst,
unsigned * pdstLen,
const byte src[],
unsigned srcLen
) {
FREE(*pdst);
if (src) {
*pdst = (byte*)MEMDUP(src, srcLen);
*pdstLen = srcLen;
}
else {
*pdst = nil;
*pdstLen = 0;
}
node->fieldFlags |= bit;
node->dirtyFlags |= bit;
}
//============================================================================
// NetVaultNodeFieldArray
//============================================================================
struct NetVaultNodeFieldArray {
enum EWhereCondition {
kAnd,
kOr
};
enum ESqlType {
kSqlInvalid,
kSqlInt32,
kSqlUInt32,
kSqlUuid,
kSqlString,
kSqlCLob,
KSqlBlob,
};
struct Field {
void * addr;
const wchar * name;
Field (void * addr, const wchar name[])
: addr(addr), name(name)
{ }
};
ARRAY(Field) fields;
NetVaultNode * node;
NetVaultNodeFieldArray (NetVaultNode * node);
~NetVaultNodeFieldArray ();
void * GetFieldAddress (qword bit);
const wchar * GetFieldName (qword bit);
// client must lock node's local critical section before calling these.
void GetFieldValueString_LCS (qword bit, wchar * dst, unsigned dstChars);
void BuildWhereClause_LCS (EWhereCondition condition, wchar * dst, unsigned dstChars);
ESqlType GetSqlType_LCS (qword bit);
};
//============================================================================
// NetVaultNodeRef (packed because is sent over wire directly)
//============================================================================
#include <PshPack1.h>
struct NetVaultNodeRef {
unsigned parentId;
unsigned childId;
unsigned ownerId;
bool seen;
};
#include <PopPack.h>
//============================================================================
// SrvPackBuffer
//============================================================================
// Allocate a CSrvPackBuffer on the heap with one extra dword to allow for padding
#define SRV_ALLOC_BUFFER(bytes) \
new(ALLOC(sizeof(CSrvPackBuffer) + (bytes) + sizeof(dword))) \
CSrvPackBuffer(bytes + sizeof(dword))
// Allocate a CSrvPackBuffer on the stack with one extra dword to allow for padding
#define SRV_ALLOCA_BUFFER(bytes) \
new(_alloca(sizeof(CSrvPackBuffer) + (bytes) + sizeof(dword))) \
CSrvPackBuffer(bytes + sizeof(dword))
class CSrvPackBuffer {
public:
CSrvPackBuffer (unsigned bytes);
void * Alloc (unsigned bytes);
void AddData (const void * ptr, unsigned bytes);
void AddString (const wchar str[]);
void AddDWordArray (const dword * arr, unsigned count);
void AddDWordArray (const unsigned * arr, unsigned count);
// add new "Add..." methods here as needed
unsigned Size ();
private:
byte * m_pos;
byte * m_end;
byte * m_data;
};
class CSrvUnpackBuffer {
public:
CSrvUnpackBuffer (const void * buffer, unsigned count);
const void * GetData (unsigned bytes);
const wchar * GetString ();
const dword * GetDWordArray (unsigned count);
unsigned BytesLeft ();
bool ParseError ();
private:
const byte * m_pos;
const byte * m_end;
/*==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/pnNetProtocol/Private/pnNpCommon.h
*
***/
#ifdef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETPROTOCOL_PRIVATE_PNNPCOMMON_H
#error "Header $/Plasma20/Sources/Plasma/NucleusLib/pnNetProtocol/Private/pnNpCommon.h included more than once"
#endif
#define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETPROTOCOL_PRIVATE_PNNPCOMMON_H
/*****************************************************************************
*
* Client message field types
*
***/
#ifdef USES_NETCLI
const NetMsgField kNetMsgFieldAccountName = NET_MSG_FIELD_STRING(kMaxAccountNameLength);
const NetMsgField kNetMsgFieldPlayerName = NET_MSG_FIELD_STRING(kMaxPlayerNameLength);
const NetMsgField kNetMsgFieldShaDigest = NET_MSG_FIELD_RAW_DATA(sizeof(ShaDigest));
const NetMsgField kNetMsgFieldUuid = NET_MSG_FIELD_DATA(sizeof(Uuid));
const NetMsgField kNetMsgFieldTransId = NET_MSG_FIELD_DWORD();
const NetMsgField kNetMsgFieldTimeMs = NET_MSG_FIELD_DWORD();
const NetMsgField kNetMsgFieldENetError = NET_MSG_FIELD_DWORD();
const NetMsgField kNetMsgFieldEAgeId = NET_MSG_FIELD_DWORD();
const NetMsgField kNetMsgFieldNetNode = NET_MSG_FIELD_DWORD();
const NetMsgField kNetMsgFieldBuildId = NET_MSG_FIELD_DWORD();
#endif
/*****************************************************************************
*
* Player information structures
*
***/
#include <PshPack1.h>
struct SrvPlayerInfo {
unsigned playerInt;
wchar playerName[kMaxPlayerNameLength];
wchar avatarShape[kMaxVaultNodeStringLength];
unsigned explorer;
};
#include <PopPack.h>
/*****************************************************************************
*
* NetAgeInfo
*
***/
struct NetAgeInfo {
Uuid ageInstId;
wchar ageFilename[kMaxAgeNameLength];
wchar ageInstName[kMaxAgeNameLength];
wchar ageUserName[kMaxAgeNameLength];
wchar ageDesc[1024];
dword ageSequenceNumber;
dword ageLanguage;
dword population; // only used with GetPublicAgeList query results
dword currentPopulation; // only used with GetPublicAgeList query results
};
/*****************************************************************************
*
* NetGameScore
*
***/
struct NetGameScore {
unsigned scoreId;
unsigned ownerId;
UInt32 createdTime;
wchar gameName[kMaxGameScoreNameLength];
unsigned gameType;
int value;
unsigned Read (const byte inbuffer[], unsigned bufsz, byte** end = nil); // returns number of bytes read
unsigned Write (ARRAY(byte) * buffer) const; // returns number of bytes written
void CopyFrom (const NetGameScore & score);
};
/*****************************************************************************
*
* NetGameRank
*
***/
struct NetGameRank {
unsigned rank;
int score;
wchar name[kMaxPlayerNameLength];
unsigned Read (const byte inbuffer[], unsigned bufsz, byte** end = nil); // returns number of bytes read
unsigned Write (ARRAY(byte) * buffer) const; // returns number of bytes written
void CopyFrom (const NetGameRank & fromRank);
};
/*****************************************************************************
*
* Server vault structures
*
***/
//============================================================================
// NetVaultNode
//============================================================================
// Threaded apps: App is responsible for locking node->critsect before accessing *any* field in this struct
struct NetVaultNode : AtomicRef {
enum RwOptions {
kRwDirtyOnly = 1<<0, // READ : No meaning
// WRITE: Only write fields marked dirty
kRwUpdateDirty = 1<<1, // READ : Set dirty flag on fields read from stream
// WRITE: Clear dirty flag on fields written to stream
};
enum CopyOptions {
kCopySetDirty = 1<<0, // set dirty flag on changed dst fields
kCopyOverwrite = 1<<1, // overwrite fields for which dst node already has values
kCopyClear = 1<<2, // clear dst fields for which src node does not have values
};
// These flag values must not change unless all servers are
// simultaneously replaced, so basically forget it.
static const qword kNodeId = (qword)1<< 0;
static const qword kCreateTime = (qword)1<< 1;
static const qword kModifyTime = (qword)1<< 2;
static const qword kCreateAgeName = (qword)1<< 3;
static const qword kCreateAgeUuid = (qword)1<< 4;
static const qword kCreatorAcct = (qword)1<< 5;
static const qword kCreatorId = (qword)1<< 6;
static const qword kNodeType = (qword)1<< 7;
static const qword kInt32_1 = (qword)1<< 8;
static const qword kInt32_2 = (qword)1<< 9;
static const qword kInt32_3 = (qword)1<<10;
static const qword kInt32_4 = (qword)1<<11;
static const qword kUInt32_1 = (qword)1<<12;
static const qword kUInt32_2 = (qword)1<<13;
static const qword kUInt32_3 = (qword)1<<14;
static const qword kUInt32_4 = (qword)1<<15;
static const qword kUuid_1 = (qword)1<<16;
static const qword kUuid_2 = (qword)1<<17;
static const qword kUuid_3 = (qword)1<<18;
static const qword kUuid_4 = (qword)1<<19;
static const qword kString64_1 = (qword)1<<20;
static const qword kString64_2 = (qword)1<<21;
static const qword kString64_3 = (qword)1<<22;
static const qword kString64_4 = (qword)1<<23;
static const qword kString64_5 = (qword)1<<24;
static const qword kString64_6 = (qword)1<<25;
static const qword kIString64_1 = (qword)1<<26;
static const qword kIString64_2 = (qword)1<<27;
// blobs always come last
static const qword kText_1 = (qword)1<<28;
static const qword kText_2 = (qword)1<<29;
static const qword kBlob_1 = (qword)1<<30;
static const qword kBlob_2 = (qword)1<<31;
CCritSect critsect;
qword fieldFlags;
qword dirtyFlags;
Uuid revisionId;
// Treat these as read-only or node flag fields will become invalid
// Threaded apps: Must be accessed with node->critsect locked
unsigned nodeId;
unsigned createTime;
unsigned modifyTime;
wchar * createAgeName;
Uuid createAgeUuid;
Uuid creatorAcct; // accountId of node creator
unsigned creatorId; // playerId of node creator
unsigned nodeType;
int int32_1;
int int32_2;
int int32_3;
int int32_4;
unsigned uint32_1;
unsigned uint32_2;
unsigned uint32_3;
unsigned uint32_4;
Uuid uuid_1;
Uuid uuid_2;
Uuid uuid_3;
Uuid uuid_4;
wchar * string64_1;
wchar * string64_2;
wchar * string64_3;
wchar * string64_4;
wchar * string64_5;
wchar * string64_6;
wchar * istring64_1;
wchar * istring64_2;
wchar * text_1;
wchar * text_2;
byte * blob_1; unsigned blob_1Length;
byte * blob_2; unsigned blob_2Length;
NetVaultNode ();
~NetVaultNode ();
// Threaded apps: Must be called with node->critsect locked
unsigned Read_LCS (const byte buffer[], unsigned bufsz, unsigned rwOpts); // returns number of bytes read
unsigned Write_LCS (ARRAY(byte) * buffer, unsigned rwOpts); // returns number of bytes written
bool Matches (const NetVaultNode * other);
void CopyFrom (const NetVaultNode * other, unsigned copyOpts);
// Threaded apps: Must be called with node->critsect locked
void SetNodeId (unsigned v);
void SetCreateTime (unsigned v);
void SetModifyTime (unsigned v);
void SetCreateAgeName (const wchar v[]);
void SetCreateAgeUuid (const Uuid & v);
void SetCreatorAcct (const Uuid & v);
void SetCreatorId (unsigned v);
void SetNodeType (unsigned v);
void SetInt32_1 (int v);
void SetInt32_2 (int v);
void SetInt32_3 (int v);
void SetInt32_4 (int v);
void SetUInt32_1 (unsigned v);
void SetUInt32_2 (unsigned v);
void SetUInt32_3 (unsigned v);
void SetUInt32_4 (unsigned v);
void SetUuid_1 (const Uuid & v);
void SetUuid_2 (const Uuid & v);
void SetUuid_3 (const Uuid & v);
void SetUuid_4 (const Uuid & v);
void SetString64_1 (const wchar v[]);
void SetString64_2 (const wchar v[]);
void SetString64_3 (const wchar v[]);
void SetString64_4 (const wchar v[]);
void SetString64_5 (const wchar v[]);
void SetString64_6 (const wchar v[]);
void SetIString64_1 (const wchar v[]);
void SetIString64_2 (const wchar v[]);
void SetText_1 (const wchar v[]);
void SetText_2 (const wchar v[]);
void SetBlob_1 (const byte v[], unsigned len);
void SetBlob_2 (const byte v[], unsigned len);
void SetText (qword fieldFlag, const wchar v[]);
void SetBlob (qword fieldFlag, const byte v[], unsigned len);
// These are only here to aid macro expansions (naming case matches field flags)
inline unsigned GetNodeId () const { return nodeId; }
inline unsigned GetCreateTime () const { return createTime; }
inline unsigned GetModifyTime () const { return modifyTime; }
inline wchar * GetCreateAgeName () const { return createAgeName; }
inline Uuid GetCreateAgeUuid () const { return createAgeUuid; }
inline Uuid GetCreatorAcct () const { return creatorAcct; }
inline unsigned GetCreatorId () const { return creatorId; }
inline unsigned GetNodeType () const { return nodeType; }
inline int GetInt32_1 () const { return int32_1; }
inline int GetInt32_2 () const { return int32_2; }
inline int GetInt32_3 () const { return int32_3; }
inline int GetInt32_4 () const { return int32_4; }
inline unsigned GetUInt32_1 () const { return uint32_1; }
inline unsigned GetUInt32_2 () const { return uint32_2; }
inline unsigned GetUInt32_3 () const { return uint32_3; }
inline unsigned GetUInt32_4 () const { return uint32_4; }
inline Uuid GetUuid_1 () const { return uuid_1; }
inline Uuid GetUuid_2 () const { return uuid_2; }
inline Uuid GetUuid_3 () const { return uuid_3; }
inline Uuid GetUuid_4 () const { return uuid_4; }
inline wchar * GetString64_1 () const { return string64_1; }
inline wchar * GetString64_2 () const { return string64_2; }
inline wchar * GetString64_3 () const { return string64_3; }
inline wchar * GetString64_4 () const { return string64_4; }
inline wchar * GetString64_5 () const { return string64_5; }
inline wchar * GetString64_6 () const { return string64_6; }
inline wchar * GetIString64_1 () const { return istring64_1; }
inline wchar * GetIString64_2 () const { return istring64_2; }
// no blob "getters"
};
//============================================================================
inline void IVaultNodeSetString (
qword bit,
NetVaultNode * node,
char ** pdst,
const char src[],
unsigned chars
) {
FREE(*pdst);
if (src && src[0])
*pdst = StrDupLen(src, chars);
else
*pdst = StrDupLen("", chars);
node->fieldFlags |= bit;
node->dirtyFlags |= bit;
}
//============================================================================
inline void IVaultNodeSetString (
qword bit,
NetVaultNode * node,
wchar ** pdst,
const wchar src[],
unsigned chars
) {
FREE(*pdst);
if (src && src[0])
*pdst = StrDupLen(src, chars);
else
*pdst = StrDupLen(L"", chars);
node->fieldFlags |= bit;
node->dirtyFlags |= bit;
}
//============================================================================
template <typename T>
inline void IVaultNodeSetValue (
qword bit,
NetVaultNode * node,
T * pdst,
const T & src
) {
*pdst = src;
node->fieldFlags |= bit;
node->dirtyFlags |= bit;
}
//============================================================================
inline void IVaultNodeSetBlob (
qword bit,
NetVaultNode * node,
byte ** pdst,
unsigned * pdstLen,
const byte src[],
unsigned srcLen
) {
FREE(*pdst);
if (src) {
*pdst = (byte*)MEMDUP(src, srcLen);
*pdstLen = srcLen;
}
else {
*pdst = nil;
*pdstLen = 0;
}
node->fieldFlags |= bit;
node->dirtyFlags |= bit;
}
//============================================================================
// NetVaultNodeFieldArray
//============================================================================
struct NetVaultNodeFieldArray {
enum EWhereCondition {
kAnd,
kOr
};
enum ESqlType {
kSqlInvalid,
kSqlInt32,
kSqlUInt32,
kSqlUuid,
kSqlString,
kSqlCLob,
KSqlBlob,
};
struct Field {
void * addr;
const wchar * name;
Field (void * addr, const wchar name[])
: addr(addr), name(name)
{ }
};
ARRAY(Field) fields;
NetVaultNode * node;
NetVaultNodeFieldArray (NetVaultNode * node);
~NetVaultNodeFieldArray ();
void * GetFieldAddress (qword bit);
const wchar * GetFieldName (qword bit);
// client must lock node's local critical section before calling these.
void GetFieldValueString_LCS (qword bit, wchar * dst, unsigned dstChars);
void BuildWhereClause_LCS (EWhereCondition condition, wchar * dst, unsigned dstChars);
ESqlType GetSqlType_LCS (qword bit);
};
//============================================================================
// NetVaultNodeRef (packed because is sent over wire directly)
//============================================================================
#include <PshPack1.h>
struct NetVaultNodeRef {
unsigned parentId;
unsigned childId;
unsigned ownerId;
bool seen;
};
#include <PopPack.h>
//============================================================================
// SrvPackBuffer
//============================================================================
// Allocate a CSrvPackBuffer on the heap with one extra dword to allow for padding
#define SRV_ALLOC_BUFFER(bytes) \
new(ALLOC(sizeof(CSrvPackBuffer) + (bytes) + sizeof(dword))) \
CSrvPackBuffer(bytes + sizeof(dword))
// Allocate a CSrvPackBuffer on the stack with one extra dword to allow for padding
#define SRV_ALLOCA_BUFFER(bytes) \
new(_alloca(sizeof(CSrvPackBuffer) + (bytes) + sizeof(dword))) \
CSrvPackBuffer(bytes + sizeof(dword))
class CSrvPackBuffer {
public:
CSrvPackBuffer (unsigned bytes);
void * Alloc (unsigned bytes);
void AddData (const void * ptr, unsigned bytes);
void AddString (const wchar str[]);
void AddDWordArray (const dword * arr, unsigned count);
void AddDWordArray (const unsigned * arr, unsigned count);
// add new "Add..." methods here as needed
unsigned Size ();
private:
byte * m_pos;
byte * m_end;
byte * m_data;
};
class CSrvUnpackBuffer {
public:
CSrvUnpackBuffer (const void * buffer, unsigned count);
const void * GetData (unsigned bytes);
const wchar * GetString ();
const dword * GetDWordArray (unsigned count);
unsigned BytesLeft ();
bool ParseError ();
private:
const byte * m_pos;
const byte * m_end;
};