mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-14 02:27:40 -04:00
Fix line endings and tabs
This commit is contained in:
@ -1,46 +1,46 @@
|
||||
/*==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/PubUtilLib/plNetGameLib/Private/plNglAllIncludes.h
|
||||
*
|
||||
***/
|
||||
|
||||
#ifdef PLASMA20_SOURCES_PLASMA_PUBUTILLIB_PLNETGAMELIB_PRIVATE_PLNGLALLINCLUDES_H
|
||||
#error "Header $/Plasma20/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAllIncludes.h included more than once"
|
||||
#endif
|
||||
#define PLASMA20_SOURCES_PLASMA_PUBUTILLIB_PLNETGAMELIB_PRIVATE_PLNGLALLINCLUDES_H
|
||||
|
||||
|
||||
// libs on which we rely
|
||||
#include "pnGameMgr/pnGameMgr.h"
|
||||
|
||||
#include "plNglCore.h"
|
||||
#include "plNglAuth.h"
|
||||
#include "plNglGame.h"
|
||||
#include "plNglFile.h"
|
||||
#include "plNglCsr.h"
|
||||
#include "plNglGateKeeper.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/PubUtilLib/plNetGameLib/Private/plNglAllIncludes.h
|
||||
*
|
||||
***/
|
||||
|
||||
#ifdef PLASMA20_SOURCES_PLASMA_PUBUTILLIB_PLNETGAMELIB_PRIVATE_PLNGLALLINCLUDES_H
|
||||
#error "Header $/Plasma20/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAllIncludes.h included more than once"
|
||||
#endif
|
||||
#define PLASMA20_SOURCES_PLASMA_PUBUTILLIB_PLNETGAMELIB_PRIVATE_PLNGLALLINCLUDES_H
|
||||
|
||||
|
||||
// libs on which we rely
|
||||
#include "pnGameMgr/pnGameMgr.h"
|
||||
|
||||
#include "plNglCore.h"
|
||||
#include "plNglAuth.h"
|
||||
#include "plNglGame.h"
|
||||
#include "plNglFile.h"
|
||||
#include "plNglCsr.h"
|
||||
#include "plNglGateKeeper.h"
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,187 +1,187 @@
|
||||
/*==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/PubUtilLib/plNetGameLib/Private/plNglCore.cpp
|
||||
*
|
||||
***/
|
||||
|
||||
#include "../Pch.h"
|
||||
#pragma hdrstop
|
||||
|
||||
|
||||
namespace Ngl {
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Private
|
||||
*
|
||||
***/
|
||||
|
||||
|
||||
struct ReportNetErrorTrans : NetNotifyTrans {
|
||||
ENetProtocol m_errProtocol;
|
||||
ENetError m_errError;
|
||||
|
||||
ReportNetErrorTrans (
|
||||
ENetProtocol errProtocol,
|
||||
ENetError errError
|
||||
);
|
||||
|
||||
void Post ();
|
||||
};
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Private data
|
||||
*
|
||||
***/
|
||||
|
||||
static FNetClientErrorProc s_errorProc;
|
||||
static long s_initCount;
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Local functions
|
||||
*
|
||||
***/
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Transactions
|
||||
*
|
||||
***/
|
||||
|
||||
//============================================================================
|
||||
// NetNotifyTrans
|
||||
//============================================================================
|
||||
NetNotifyTrans::NetNotifyTrans (ETransType transType)
|
||||
: NetTrans(kNetProtocolNil, transType)
|
||||
{
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
// ReportNetErrorTrans
|
||||
//============================================================================
|
||||
ReportNetErrorTrans::ReportNetErrorTrans (
|
||||
ENetProtocol errProtocol,
|
||||
ENetError errError
|
||||
) : NetNotifyTrans(kReportNetErrorTrans)
|
||||
, m_errProtocol(errProtocol)
|
||||
, m_errError(errError)
|
||||
{ }
|
||||
|
||||
//============================================================================
|
||||
void ReportNetErrorTrans::Post () {
|
||||
if (s_errorProc)
|
||||
s_errorProc(m_errProtocol, m_errError);
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Module functions
|
||||
*
|
||||
***/
|
||||
|
||||
//============================================================================
|
||||
void ReportNetError (ENetProtocol protocol, ENetError error) {
|
||||
ReportNetErrorTrans * trans = NEW(ReportNetErrorTrans)(protocol, error);
|
||||
NetTransSend(trans);
|
||||
}
|
||||
|
||||
} using namespace Ngl;
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Exports
|
||||
*
|
||||
***/
|
||||
|
||||
//============================================================================
|
||||
void NetClientInitialize () {
|
||||
|
||||
if (0 == AtomicAdd(&s_initCount, 1)) {
|
||||
NetTransInitialize();
|
||||
AuthInitialize();
|
||||
GameInitialize();
|
||||
FileInitialize();
|
||||
CsrInitialize();
|
||||
GateKeeperInitialize();
|
||||
}
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
void NetClientCancelAllTrans () {
|
||||
NetTransCancelAll(kNetErrTimeout);
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
void NetClientDestroy (bool wait) {
|
||||
|
||||
if (1 == AtomicAdd(&s_initCount, -1)) {
|
||||
s_errorProc = nil;
|
||||
|
||||
GateKeeperDestroy(false);
|
||||
CsrDestroy(false);
|
||||
FileDestroy(false);
|
||||
GameDestroy(false);
|
||||
AuthDestroy(false);
|
||||
NetTransDestroy(false);
|
||||
if (wait) {
|
||||
GateKeeperDestroy(true);
|
||||
CsrDestroy(true);
|
||||
FileDestroy(true);
|
||||
GameDestroy(true);
|
||||
AuthDestroy(true);
|
||||
NetTransDestroy(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
void NetClientUpdate () {
|
||||
NetTransUpdate();
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
void NetClientSetTransTimeoutMs (unsigned ms) {
|
||||
NetTransSetTimeoutMs(ms);
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
void NetClientPingEnable (bool enable) {
|
||||
AuthPingEnable(enable);
|
||||
GamePingEnable(enable);
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
void NetClientSetErrorHandler (FNetClientErrorProc errorProc) {
|
||||
s_errorProc = errorProc;
|
||||
}
|
||||
/*==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/PubUtilLib/plNetGameLib/Private/plNglCore.cpp
|
||||
*
|
||||
***/
|
||||
|
||||
#include "../Pch.h"
|
||||
#pragma hdrstop
|
||||
|
||||
|
||||
namespace Ngl {
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Private
|
||||
*
|
||||
***/
|
||||
|
||||
|
||||
struct ReportNetErrorTrans : NetNotifyTrans {
|
||||
ENetProtocol m_errProtocol;
|
||||
ENetError m_errError;
|
||||
|
||||
ReportNetErrorTrans (
|
||||
ENetProtocol errProtocol,
|
||||
ENetError errError
|
||||
);
|
||||
|
||||
void Post ();
|
||||
};
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Private data
|
||||
*
|
||||
***/
|
||||
|
||||
static FNetClientErrorProc s_errorProc;
|
||||
static long s_initCount;
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Local functions
|
||||
*
|
||||
***/
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Transactions
|
||||
*
|
||||
***/
|
||||
|
||||
//============================================================================
|
||||
// NetNotifyTrans
|
||||
//============================================================================
|
||||
NetNotifyTrans::NetNotifyTrans (ETransType transType)
|
||||
: NetTrans(kNetProtocolNil, transType)
|
||||
{
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
// ReportNetErrorTrans
|
||||
//============================================================================
|
||||
ReportNetErrorTrans::ReportNetErrorTrans (
|
||||
ENetProtocol errProtocol,
|
||||
ENetError errError
|
||||
) : NetNotifyTrans(kReportNetErrorTrans)
|
||||
, m_errProtocol(errProtocol)
|
||||
, m_errError(errError)
|
||||
{ }
|
||||
|
||||
//============================================================================
|
||||
void ReportNetErrorTrans::Post () {
|
||||
if (s_errorProc)
|
||||
s_errorProc(m_errProtocol, m_errError);
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Module functions
|
||||
*
|
||||
***/
|
||||
|
||||
//============================================================================
|
||||
void ReportNetError (ENetProtocol protocol, ENetError error) {
|
||||
ReportNetErrorTrans * trans = NEW(ReportNetErrorTrans)(protocol, error);
|
||||
NetTransSend(trans);
|
||||
}
|
||||
|
||||
} using namespace Ngl;
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Exports
|
||||
*
|
||||
***/
|
||||
|
||||
//============================================================================
|
||||
void NetClientInitialize () {
|
||||
|
||||
if (0 == AtomicAdd(&s_initCount, 1)) {
|
||||
NetTransInitialize();
|
||||
AuthInitialize();
|
||||
GameInitialize();
|
||||
FileInitialize();
|
||||
CsrInitialize();
|
||||
GateKeeperInitialize();
|
||||
}
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
void NetClientCancelAllTrans () {
|
||||
NetTransCancelAll(kNetErrTimeout);
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
void NetClientDestroy (bool wait) {
|
||||
|
||||
if (1 == AtomicAdd(&s_initCount, -1)) {
|
||||
s_errorProc = nil;
|
||||
|
||||
GateKeeperDestroy(false);
|
||||
CsrDestroy(false);
|
||||
FileDestroy(false);
|
||||
GameDestroy(false);
|
||||
AuthDestroy(false);
|
||||
NetTransDestroy(false);
|
||||
if (wait) {
|
||||
GateKeeperDestroy(true);
|
||||
CsrDestroy(true);
|
||||
FileDestroy(true);
|
||||
GameDestroy(true);
|
||||
AuthDestroy(true);
|
||||
NetTransDestroy(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
void NetClientUpdate () {
|
||||
NetTransUpdate();
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
void NetClientSetTransTimeoutMs (unsigned ms) {
|
||||
NetTransSetTimeoutMs(ms);
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
void NetClientPingEnable (bool enable) {
|
||||
AuthPingEnable(enable);
|
||||
GamePingEnable(enable);
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
void NetClientSetErrorHandler (FNetClientErrorProc errorProc) {
|
||||
s_errorProc = errorProc;
|
||||
}
|
||||
|
@ -1,58 +1,58 @@
|
||||
/*==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/PubUtilLib/plNetGameLib/Private/plNglCore.h
|
||||
*
|
||||
***/
|
||||
|
||||
#ifdef PLASMA20_SOURCES_PLASMA_PUBUTILLIB_PLNETGAMELIB_PRIVATE_PLNGLCORE_H
|
||||
#error "Header $/Plasma20/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglCore.h included more than once"
|
||||
#endif
|
||||
#define PLASMA20_SOURCES_PLASMA_PUBUTILLIB_PLNETGAMELIB_PRIVATE_PLNGLCORE_H
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Core functions
|
||||
*
|
||||
***/
|
||||
|
||||
void NetClientInitialize ();
|
||||
// void NetClientCancelAllTrans ();
|
||||
void NetClientDestroy (bool wait = true);
|
||||
|
||||
void NetClientUpdate ();
|
||||
|
||||
void NetClientSetTransTimeoutMs (unsigned ms);
|
||||
void NetClientPingEnable (bool enable);
|
||||
|
||||
typedef void (*FNetClientErrorProc)(
|
||||
ENetProtocol protocol,
|
||||
ENetError error
|
||||
);
|
||||
void NetClientSetErrorHandler (FNetClientErrorProc errorProc);
|
||||
/*==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/PubUtilLib/plNetGameLib/Private/plNglCore.h
|
||||
*
|
||||
***/
|
||||
|
||||
#ifdef PLASMA20_SOURCES_PLASMA_PUBUTILLIB_PLNETGAMELIB_PRIVATE_PLNGLCORE_H
|
||||
#error "Header $/Plasma20/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglCore.h included more than once"
|
||||
#endif
|
||||
#define PLASMA20_SOURCES_PLASMA_PUBUTILLIB_PLNETGAMELIB_PRIVATE_PLNGLCORE_H
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Core functions
|
||||
*
|
||||
***/
|
||||
|
||||
void NetClientInitialize ();
|
||||
// void NetClientCancelAllTrans ();
|
||||
void NetClientDestroy (bool wait = true);
|
||||
|
||||
void NetClientUpdate ();
|
||||
|
||||
void NetClientSetTransTimeoutMs (unsigned ms);
|
||||
void NetClientPingEnable (bool enable);
|
||||
|
||||
typedef void (*FNetClientErrorProc)(
|
||||
ENetProtocol protocol,
|
||||
ENetError error
|
||||
);
|
||||
void NetClientSetErrorHandler (FNetClientErrorProc errorProc);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,78 +1,78 @@
|
||||
/*==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/PubUtilLib/plNetGameLib/Private/plNglCsr.h
|
||||
*
|
||||
***/
|
||||
|
||||
#ifdef PLASMA20_SOURCES_PLASMA_PUBUTILLIB_PLNETGAMELIB_PRIVATE_PLNGLCSR_H
|
||||
#error "Header $/Plasma20/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglCsr.h included more than once"
|
||||
#endif
|
||||
#define PLASMA20_SOURCES_PLASMA_PUBUTILLIB_PLNETGAMELIB_PRIVATE_PLNGLCSR_H
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Client-side CSR functions
|
||||
*
|
||||
***/
|
||||
|
||||
typedef void (*FNetCliCsrConnectedCallback) (
|
||||
void * param,
|
||||
unsigned latestBuildId
|
||||
);
|
||||
void NetCliCsrStartConnect (
|
||||
const wchar * addrList[],
|
||||
unsigned addrCount,
|
||||
FNetCliCsrConnectedCallback callback = nil,
|
||||
void * param = nil
|
||||
);
|
||||
void NetCliCsrDisconnect ();
|
||||
|
||||
typedef void (*FNetCliCsrLoginCallback)(
|
||||
ENetError result,
|
||||
void * param,
|
||||
const Uuid & csrId,
|
||||
unsigned csrFlags
|
||||
);
|
||||
void NetCliCsrLoginRequest (
|
||||
const wchar csrName[],
|
||||
const ShaDigest & namePassHash,
|
||||
FNetCliCsrLoginCallback callback,
|
||||
void * param
|
||||
);
|
||||
|
||||
typedef void (*FNetCliCsrSetTicketFilterCallback)(
|
||||
ENetError result,
|
||||
void * param
|
||||
);
|
||||
void NetCliCsrSetTicketFilter (
|
||||
const wchar filterSpec[],
|
||||
FNetCliCsrSetTicketFilterCallback callback,
|
||||
void * param
|
||||
);
|
||||
|
||||
/*==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/PubUtilLib/plNetGameLib/Private/plNglCsr.h
|
||||
*
|
||||
***/
|
||||
|
||||
#ifdef PLASMA20_SOURCES_PLASMA_PUBUTILLIB_PLNETGAMELIB_PRIVATE_PLNGLCSR_H
|
||||
#error "Header $/Plasma20/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglCsr.h included more than once"
|
||||
#endif
|
||||
#define PLASMA20_SOURCES_PLASMA_PUBUTILLIB_PLNETGAMELIB_PRIVATE_PLNGLCSR_H
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Client-side CSR functions
|
||||
*
|
||||
***/
|
||||
|
||||
typedef void (*FNetCliCsrConnectedCallback) (
|
||||
void * param,
|
||||
unsigned latestBuildId
|
||||
);
|
||||
void NetCliCsrStartConnect (
|
||||
const wchar * addrList[],
|
||||
unsigned addrCount,
|
||||
FNetCliCsrConnectedCallback callback = nil,
|
||||
void * param = nil
|
||||
);
|
||||
void NetCliCsrDisconnect ();
|
||||
|
||||
typedef void (*FNetCliCsrLoginCallback)(
|
||||
ENetError result,
|
||||
void * param,
|
||||
const Uuid & csrId,
|
||||
unsigned csrFlags
|
||||
);
|
||||
void NetCliCsrLoginRequest (
|
||||
const wchar csrName[],
|
||||
const ShaDigest & namePassHash,
|
||||
FNetCliCsrLoginCallback callback,
|
||||
void * param
|
||||
);
|
||||
|
||||
typedef void (*FNetCliCsrSetTicketFilterCallback)(
|
||||
ENetError result,
|
||||
void * param
|
||||
);
|
||||
void NetCliCsrSetTicketFilter (
|
||||
const wchar filterSpec[],
|
||||
FNetCliCsrSetTicketFilterCallback callback,
|
||||
void * param
|
||||
);
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,121 +1,121 @@
|
||||
/*==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/PubUtilLib/plNetGameLib/Private/plNglFile.h
|
||||
*
|
||||
***/
|
||||
|
||||
#ifdef PLASMA20_SOURCES_PLASMA_PUBUTILLIB_PLNETGAMELIB_PRIVATE_PLNGLFILE_H
|
||||
#error "Header $/Plasma20/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglFile.h included more than once"
|
||||
#endif
|
||||
#define PLASMA20_SOURCES_PLASMA_PUBUTILLIB_PLNETGAMELIB_PRIVATE_PLNGLFILE_H
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Client file functions
|
||||
*
|
||||
***/
|
||||
|
||||
|
||||
//============================================================================
|
||||
// Connect
|
||||
//============================================================================
|
||||
void NetCliFileStartConnect (
|
||||
const wchar * fileAddrList[],
|
||||
unsigned fileAddrCount,
|
||||
bool isPatcher = false
|
||||
);
|
||||
void NetCliFileStartConnectAsServer (
|
||||
const wchar * fileAddrList[],
|
||||
unsigned fileAddrCount,
|
||||
unsigned serverType,
|
||||
unsigned serverBuildId
|
||||
);
|
||||
|
||||
//============================================================================
|
||||
// Disconnect
|
||||
//============================================================================
|
||||
void NetCliFileDisconnect ();
|
||||
|
||||
//============================================================================
|
||||
// File server related messages
|
||||
//============================================================================
|
||||
typedef void (*FNetCliFileBuildIdRequestCallback)(
|
||||
ENetError result,
|
||||
void * param,
|
||||
unsigned buildId
|
||||
);
|
||||
void NetCliFileBuildIdRequest (
|
||||
FNetCliFileBuildIdRequestCallback callback,
|
||||
void * param
|
||||
);
|
||||
typedef void (*FNetCliFileBuildIdUpdateCallback)(unsigned buildId);
|
||||
void NetCliFileRegisterBuildIdUpdate (FNetCliFileBuildIdUpdateCallback callback);
|
||||
|
||||
//============================================================================
|
||||
// Manifest
|
||||
//============================================================================
|
||||
struct NetCliFileManifestEntry {
|
||||
wchar clientName[MAX_PATH]; // path and file on client side (for comparison)
|
||||
wchar downloadName[MAX_PATH]; // path and file on server side (for download)
|
||||
wchar md5[MAX_PATH];
|
||||
wchar md5compressed[MAX_PATH]; // md5 for the compressed file
|
||||
unsigned fileSize;
|
||||
unsigned zipSize;
|
||||
unsigned flags;
|
||||
};
|
||||
typedef void (*FNetCliFileManifestRequestCallback)(
|
||||
ENetError result,
|
||||
void * param,
|
||||
const wchar group[],
|
||||
const NetCliFileManifestEntry manifest[],
|
||||
unsigned entryCount
|
||||
);
|
||||
void NetCliFileManifestRequest (
|
||||
FNetCliFileManifestRequestCallback callback,
|
||||
void * param,
|
||||
const wchar group[], // the group of files you want (empty or nil = all)
|
||||
unsigned buildId = 0 // 0 = get latest, other = get particular build (servers only)
|
||||
);
|
||||
|
||||
//============================================================================
|
||||
// File Download
|
||||
//============================================================================
|
||||
typedef void (*FNetCliFileDownloadRequestCallback)(
|
||||
ENetError result,
|
||||
void * param,
|
||||
const wchar filename[],
|
||||
hsStream * writer
|
||||
);
|
||||
void NetCliFileDownloadRequest (
|
||||
const wchar filename[],
|
||||
hsStream * writer,
|
||||
FNetCliFileDownloadRequestCallback callback,
|
||||
void * param,
|
||||
unsigned buildId = 0 // 0 = get latest, other = get particular build (servers only)
|
||||
);
|
||||
/*==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/PubUtilLib/plNetGameLib/Private/plNglFile.h
|
||||
*
|
||||
***/
|
||||
|
||||
#ifdef PLASMA20_SOURCES_PLASMA_PUBUTILLIB_PLNETGAMELIB_PRIVATE_PLNGLFILE_H
|
||||
#error "Header $/Plasma20/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglFile.h included more than once"
|
||||
#endif
|
||||
#define PLASMA20_SOURCES_PLASMA_PUBUTILLIB_PLNETGAMELIB_PRIVATE_PLNGLFILE_H
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Client file functions
|
||||
*
|
||||
***/
|
||||
|
||||
|
||||
//============================================================================
|
||||
// Connect
|
||||
//============================================================================
|
||||
void NetCliFileStartConnect (
|
||||
const wchar * fileAddrList[],
|
||||
unsigned fileAddrCount,
|
||||
bool isPatcher = false
|
||||
);
|
||||
void NetCliFileStartConnectAsServer (
|
||||
const wchar * fileAddrList[],
|
||||
unsigned fileAddrCount,
|
||||
unsigned serverType,
|
||||
unsigned serverBuildId
|
||||
);
|
||||
|
||||
//============================================================================
|
||||
// Disconnect
|
||||
//============================================================================
|
||||
void NetCliFileDisconnect ();
|
||||
|
||||
//============================================================================
|
||||
// File server related messages
|
||||
//============================================================================
|
||||
typedef void (*FNetCliFileBuildIdRequestCallback)(
|
||||
ENetError result,
|
||||
void * param,
|
||||
unsigned buildId
|
||||
);
|
||||
void NetCliFileBuildIdRequest (
|
||||
FNetCliFileBuildIdRequestCallback callback,
|
||||
void * param
|
||||
);
|
||||
typedef void (*FNetCliFileBuildIdUpdateCallback)(unsigned buildId);
|
||||
void NetCliFileRegisterBuildIdUpdate (FNetCliFileBuildIdUpdateCallback callback);
|
||||
|
||||
//============================================================================
|
||||
// Manifest
|
||||
//============================================================================
|
||||
struct NetCliFileManifestEntry {
|
||||
wchar clientName[MAX_PATH]; // path and file on client side (for comparison)
|
||||
wchar downloadName[MAX_PATH]; // path and file on server side (for download)
|
||||
wchar md5[MAX_PATH];
|
||||
wchar md5compressed[MAX_PATH]; // md5 for the compressed file
|
||||
unsigned fileSize;
|
||||
unsigned zipSize;
|
||||
unsigned flags;
|
||||
};
|
||||
typedef void (*FNetCliFileManifestRequestCallback)(
|
||||
ENetError result,
|
||||
void * param,
|
||||
const wchar group[],
|
||||
const NetCliFileManifestEntry manifest[],
|
||||
unsigned entryCount
|
||||
);
|
||||
void NetCliFileManifestRequest (
|
||||
FNetCliFileManifestRequestCallback callback,
|
||||
void * param,
|
||||
const wchar group[], // the group of files you want (empty or nil = all)
|
||||
unsigned buildId = 0 // 0 = get latest, other = get particular build (servers only)
|
||||
);
|
||||
|
||||
//============================================================================
|
||||
// File Download
|
||||
//============================================================================
|
||||
typedef void (*FNetCliFileDownloadRequestCallback)(
|
||||
ENetError result,
|
||||
void * param,
|
||||
const wchar filename[],
|
||||
hsStream * writer
|
||||
);
|
||||
void NetCliFileDownloadRequest (
|
||||
const wchar filename[],
|
||||
hsStream * writer,
|
||||
FNetCliFileDownloadRequestCallback callback,
|
||||
void * param,
|
||||
unsigned buildId = 0 // 0 = get latest, other = get particular build (servers only)
|
||||
);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -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/PubUtilLib/plNetGameLib/Private/plNglGame.h
|
||||
*
|
||||
***/
|
||||
|
||||
#ifdef PLASMA20_SOURCES_PLASMA_PUBUTILLIB_PLNETGAMELIB_PRIVATE_PLNGLGAME_H
|
||||
#error "Header $/Plasma20/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGame.h included more than once"
|
||||
#endif
|
||||
#define PLASMA20_SOURCES_PLASMA_PUBUTILLIB_PLNETGAMELIB_PRIVATE_PLNGLGAME_H
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Client-side Game functions
|
||||
*
|
||||
***/
|
||||
|
||||
//============================================================================
|
||||
// Connect
|
||||
//============================================================================
|
||||
void NetCliGameStartConnect (
|
||||
const NetAddressNode & node
|
||||
);
|
||||
|
||||
//============================================================================
|
||||
// Disconnect
|
||||
//============================================================================
|
||||
void NetCliGameDisconnect ();
|
||||
|
||||
//============================================================================
|
||||
// Join Age
|
||||
//============================================================================
|
||||
typedef void (*FNetCliGameJoinAgeRequestCallback)(
|
||||
ENetError result,
|
||||
void * param
|
||||
);
|
||||
void NetCliGameJoinAgeRequest (
|
||||
unsigned ageMcpId,
|
||||
const Uuid & accountUuid,
|
||||
unsigned playerInt,
|
||||
FNetCliGameJoinAgeRequestCallback callback,
|
||||
void * param
|
||||
);
|
||||
|
||||
//============================================================================
|
||||
// Propagate app-specific data
|
||||
//============================================================================
|
||||
typedef void (*FNetCliGameRecvBufferHandler)(
|
||||
unsigned type,
|
||||
unsigned bytes,
|
||||
const byte buffer[]
|
||||
);
|
||||
void NetCliGameSetRecvBufferHandler (
|
||||
FNetCliGameRecvBufferHandler handler
|
||||
);
|
||||
void NetCliGamePropagateBuffer (
|
||||
unsigned type,
|
||||
unsigned bytes,
|
||||
const byte buffer[]
|
||||
);
|
||||
|
||||
//============================================================================
|
||||
// GameMgrMsg
|
||||
//============================================================================
|
||||
struct GameMsgHeader;
|
||||
typedef void (*FNetCliGameRecvGameMgrMsgHandler)(GameMsgHeader * msg);
|
||||
void NetCliGameSetRecvGameMgrMsgHandler (FNetCliGameRecvGameMgrMsgHandler handler);
|
||||
void NetCliGameSendGameMgrMsg (GameMsgHeader * msg);
|
||||
/*==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/PubUtilLib/plNetGameLib/Private/plNglGame.h
|
||||
*
|
||||
***/
|
||||
|
||||
#ifdef PLASMA20_SOURCES_PLASMA_PUBUTILLIB_PLNETGAMELIB_PRIVATE_PLNGLGAME_H
|
||||
#error "Header $/Plasma20/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGame.h included more than once"
|
||||
#endif
|
||||
#define PLASMA20_SOURCES_PLASMA_PUBUTILLIB_PLNETGAMELIB_PRIVATE_PLNGLGAME_H
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Client-side Game functions
|
||||
*
|
||||
***/
|
||||
|
||||
//============================================================================
|
||||
// Connect
|
||||
//============================================================================
|
||||
void NetCliGameStartConnect (
|
||||
const NetAddressNode & node
|
||||
);
|
||||
|
||||
//============================================================================
|
||||
// Disconnect
|
||||
//============================================================================
|
||||
void NetCliGameDisconnect ();
|
||||
|
||||
//============================================================================
|
||||
// Join Age
|
||||
//============================================================================
|
||||
typedef void (*FNetCliGameJoinAgeRequestCallback)(
|
||||
ENetError result,
|
||||
void * param
|
||||
);
|
||||
void NetCliGameJoinAgeRequest (
|
||||
unsigned ageMcpId,
|
||||
const Uuid & accountUuid,
|
||||
unsigned playerInt,
|
||||
FNetCliGameJoinAgeRequestCallback callback,
|
||||
void * param
|
||||
);
|
||||
|
||||
//============================================================================
|
||||
// Propagate app-specific data
|
||||
//============================================================================
|
||||
typedef void (*FNetCliGameRecvBufferHandler)(
|
||||
unsigned type,
|
||||
unsigned bytes,
|
||||
const byte buffer[]
|
||||
);
|
||||
void NetCliGameSetRecvBufferHandler (
|
||||
FNetCliGameRecvBufferHandler handler
|
||||
);
|
||||
void NetCliGamePropagateBuffer (
|
||||
unsigned type,
|
||||
unsigned bytes,
|
||||
const byte buffer[]
|
||||
);
|
||||
|
||||
//============================================================================
|
||||
// GameMgrMsg
|
||||
//============================================================================
|
||||
struct GameMsgHeader;
|
||||
typedef void (*FNetCliGameRecvGameMgrMsgHandler)(GameMsgHeader * msg);
|
||||
void NetCliGameSetRecvGameMgrMsgHandler (FNetCliGameRecvGameMgrMsgHandler handler);
|
||||
void NetCliGameSendGameMgrMsg (GameMsgHeader * msg);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,121 +1,121 @@
|
||||
/*==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/PubUtilLib/plNetGameLib/Private/plNglGateKeeper.h
|
||||
*
|
||||
***/
|
||||
|
||||
#ifdef PLASMA20_SOURCES_PLASMA_PUBUTILLIB_PLNETGAMELIB_PRIVATE_PLNGLGATEKEEPER_H
|
||||
#error "Header $/Plasma20/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGateKeeper.h included more than once"
|
||||
#endif
|
||||
#define PLASMA20_SOURCES_PLASMA_PUBUTILLIB_PLNETGAMELIB_PRIVATE_PLNGLGATEKEEPER_H
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Client gatekeeper functions
|
||||
*
|
||||
***/
|
||||
|
||||
|
||||
//============================================================================
|
||||
// Connect
|
||||
//============================================================================
|
||||
void NetCliGateKeeperStartConnect (
|
||||
const wchar * gateKeeperAddrList[],
|
||||
unsigned gateKeeperAddrCount
|
||||
);
|
||||
|
||||
bool NetCliGateKeeperQueryConnected ();
|
||||
void NetCliGateKeeperAutoReconnectEnable (bool enable); // is enabled by default
|
||||
|
||||
// Called after the gatekeeper/client connection is encrypted
|
||||
typedef void (*FNetCliGateKeeperConnectCallback)();
|
||||
void NetCliGateKeeperSetConnectCallback (
|
||||
FNetCliGateKeeperConnectCallback callback
|
||||
);
|
||||
|
||||
|
||||
//============================================================================
|
||||
// Disconnect
|
||||
//============================================================================
|
||||
void NetCliGateKeeperDisconnect ();
|
||||
void NetCliGateKeeperUnexpectedDisconnect ();
|
||||
|
||||
|
||||
//============================================================================
|
||||
// Ping
|
||||
//============================================================================
|
||||
typedef void (*FNetCliGateKeeperPingRequestCallback)(
|
||||
ENetError result,
|
||||
void * param,
|
||||
unsigned pingAtMs,
|
||||
unsigned replyAtMs,
|
||||
unsigned payloadbytes,
|
||||
const byte payload[]
|
||||
);
|
||||
void NetCliGateKeeperPingRequest (
|
||||
unsigned pingTimeMs,
|
||||
unsigned payloadBytes, // max 64k (pnNetCli enforced upon send)
|
||||
const void * payload,
|
||||
FNetCliGateKeeperPingRequestCallback callback,
|
||||
void * param
|
||||
);
|
||||
|
||||
|
||||
//============================================================================
|
||||
// FileSrvIpAddress
|
||||
//============================================================================
|
||||
typedef void (*FNetCliGateKeeperFileSrvIpAddressRequestCallback)(
|
||||
ENetError result,
|
||||
void * param,
|
||||
const wchar addr[]
|
||||
);
|
||||
|
||||
void NetCliGateKeeperFileSrvIpAddressRequest (
|
||||
FNetCliGateKeeperFileSrvIpAddressRequestCallback callback,
|
||||
void * param,
|
||||
bool isPatcher
|
||||
);
|
||||
|
||||
|
||||
//============================================================================
|
||||
// AuthSrvIpAddress
|
||||
//============================================================================
|
||||
typedef void (*FNetCliGateKeeperAuthSrvIpAddressRequestCallback)(
|
||||
ENetError result,
|
||||
void * param,
|
||||
const wchar addr[]
|
||||
);
|
||||
|
||||
void NetCliGateKeeperAuthSrvIpAddressRequest (
|
||||
FNetCliGateKeeperAuthSrvIpAddressRequestCallback callback,
|
||||
void * param
|
||||
);
|
||||
|
||||
|
||||
|
||||
/*==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/PubUtilLib/plNetGameLib/Private/plNglGateKeeper.h
|
||||
*
|
||||
***/
|
||||
|
||||
#ifdef PLASMA20_SOURCES_PLASMA_PUBUTILLIB_PLNETGAMELIB_PRIVATE_PLNGLGATEKEEPER_H
|
||||
#error "Header $/Plasma20/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGateKeeper.h included more than once"
|
||||
#endif
|
||||
#define PLASMA20_SOURCES_PLASMA_PUBUTILLIB_PLNETGAMELIB_PRIVATE_PLNGLGATEKEEPER_H
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Client gatekeeper functions
|
||||
*
|
||||
***/
|
||||
|
||||
|
||||
//============================================================================
|
||||
// Connect
|
||||
//============================================================================
|
||||
void NetCliGateKeeperStartConnect (
|
||||
const wchar * gateKeeperAddrList[],
|
||||
unsigned gateKeeperAddrCount
|
||||
);
|
||||
|
||||
bool NetCliGateKeeperQueryConnected ();
|
||||
void NetCliGateKeeperAutoReconnectEnable (bool enable); // is enabled by default
|
||||
|
||||
// Called after the gatekeeper/client connection is encrypted
|
||||
typedef void (*FNetCliGateKeeperConnectCallback)();
|
||||
void NetCliGateKeeperSetConnectCallback (
|
||||
FNetCliGateKeeperConnectCallback callback
|
||||
);
|
||||
|
||||
|
||||
//============================================================================
|
||||
// Disconnect
|
||||
//============================================================================
|
||||
void NetCliGateKeeperDisconnect ();
|
||||
void NetCliGateKeeperUnexpectedDisconnect ();
|
||||
|
||||
|
||||
//============================================================================
|
||||
// Ping
|
||||
//============================================================================
|
||||
typedef void (*FNetCliGateKeeperPingRequestCallback)(
|
||||
ENetError result,
|
||||
void * param,
|
||||
unsigned pingAtMs,
|
||||
unsigned replyAtMs,
|
||||
unsigned payloadbytes,
|
||||
const byte payload[]
|
||||
);
|
||||
void NetCliGateKeeperPingRequest (
|
||||
unsigned pingTimeMs,
|
||||
unsigned payloadBytes, // max 64k (pnNetCli enforced upon send)
|
||||
const void * payload,
|
||||
FNetCliGateKeeperPingRequestCallback callback,
|
||||
void * param
|
||||
);
|
||||
|
||||
|
||||
//============================================================================
|
||||
// FileSrvIpAddress
|
||||
//============================================================================
|
||||
typedef void (*FNetCliGateKeeperFileSrvIpAddressRequestCallback)(
|
||||
ENetError result,
|
||||
void * param,
|
||||
const wchar addr[]
|
||||
);
|
||||
|
||||
void NetCliGateKeeperFileSrvIpAddressRequest (
|
||||
FNetCliGateKeeperFileSrvIpAddressRequestCallback callback,
|
||||
void * param,
|
||||
bool isPatcher
|
||||
);
|
||||
|
||||
|
||||
//============================================================================
|
||||
// AuthSrvIpAddress
|
||||
//============================================================================
|
||||
typedef void (*FNetCliGateKeeperAuthSrvIpAddressRequestCallback)(
|
||||
ENetError result,
|
||||
void * param,
|
||||
const wchar addr[]
|
||||
);
|
||||
|
||||
void NetCliGateKeeperAuthSrvIpAddressRequest (
|
||||
FNetCliGateKeeperAuthSrvIpAddressRequestCallback callback,
|
||||
void * param
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
@ -1,73 +1,73 @@
|
||||
/*==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/PubUtilLib/plNetGameLib/Private/plNglMisc.cpp
|
||||
*
|
||||
***/
|
||||
|
||||
#include "../Pch.h"
|
||||
#pragma hdrstop
|
||||
|
||||
|
||||
namespace Ngl {
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Private data
|
||||
*
|
||||
***/
|
||||
|
||||
static unsigned s_connSequence;
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Module functions
|
||||
*
|
||||
***/
|
||||
|
||||
//============================================================================
|
||||
unsigned ConnNextSequence () {
|
||||
if (!++s_connSequence)
|
||||
++s_connSequence;
|
||||
return s_connSequence;
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
unsigned ConnGetId (ENetProtocol protocol) {
|
||||
switch (protocol) {
|
||||
case kNetProtocolCli2Auth: return AuthGetConnId();
|
||||
case kNetProtocolCli2Game: return GameGetConnId();
|
||||
case kNetProtocolCli2File: return FileGetConnId();
|
||||
case kNetProtocolCli2Csr: return CsrGetConnId();
|
||||
case kNetProtocolCli2GateKeeper: return GateKeeperGetConnId();
|
||||
DEFAULT_FATAL(protocol);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // namespace Ngl
|
||||
/*==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/PubUtilLib/plNetGameLib/Private/plNglMisc.cpp
|
||||
*
|
||||
***/
|
||||
|
||||
#include "../Pch.h"
|
||||
#pragma hdrstop
|
||||
|
||||
|
||||
namespace Ngl {
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Private data
|
||||
*
|
||||
***/
|
||||
|
||||
static unsigned s_connSequence;
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Module functions
|
||||
*
|
||||
***/
|
||||
|
||||
//============================================================================
|
||||
unsigned ConnNextSequence () {
|
||||
if (!++s_connSequence)
|
||||
++s_connSequence;
|
||||
return s_connSequence;
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
unsigned ConnGetId (ENetProtocol protocol) {
|
||||
switch (protocol) {
|
||||
case kNetProtocolCli2Auth: return AuthGetConnId();
|
||||
case kNetProtocolCli2Game: return GameGetConnId();
|
||||
case kNetProtocolCli2File: return FileGetConnId();
|
||||
case kNetProtocolCli2Csr: return CsrGetConnId();
|
||||
case kNetProtocolCli2GateKeeper: return GateKeeperGetConnId();
|
||||
DEFAULT_FATAL(protocol);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // namespace Ngl
|
||||
|
@ -1,343 +1,343 @@
|
||||
/*==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/PubUtilLib/plNetGameLib/Private/plNglTrans.cpp
|
||||
*
|
||||
***/
|
||||
|
||||
#include "../Pch.h"
|
||||
#pragma hdrstop
|
||||
|
||||
|
||||
namespace Ngl {
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Private
|
||||
*
|
||||
***/
|
||||
|
||||
enum {
|
||||
kPerfCurrTransactions,
|
||||
kNumPerf
|
||||
};
|
||||
|
||||
static const unsigned kDefaultTimeoutMs = 5 * 60 * 1000;
|
||||
|
||||
static bool s_running;
|
||||
static CCritSect s_critsect;
|
||||
static LISTDECL(NetTrans, m_link) s_transactions;
|
||||
static long s_perf[kNumPerf];
|
||||
static unsigned s_timeoutMs = kDefaultTimeoutMs;
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Internal functions
|
||||
*
|
||||
***/
|
||||
|
||||
//============================================================================
|
||||
static NetTrans * FindTransIncRef_CS (unsigned transId, const char tag[]) {
|
||||
// There shouldn't be more than a few transactions; just do a linear scan
|
||||
for (NetTrans * trans = s_transactions.Head(); trans; trans = s_transactions.Next(trans))
|
||||
if (trans->m_transId == transId) {
|
||||
trans->IncRef(tag);
|
||||
return trans;
|
||||
}
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
static NetTrans * FindTransIncRef (unsigned transId, const char tag[]) {
|
||||
NetTrans * trans;
|
||||
s_critsect.Enter();
|
||||
{
|
||||
trans = FindTransIncRef_CS(transId, tag);
|
||||
}
|
||||
s_critsect.Leave();
|
||||
return trans;
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
static void CancelTrans_CS (NetTrans * trans, ENetError error) {
|
||||
ASSERT(IS_NET_ERROR(error));
|
||||
if (trans->m_state != kTransStateComplete) {
|
||||
trans->m_result = error;
|
||||
trans->m_state = kTransStateComplete;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* NetTrans implementation
|
||||
*
|
||||
***/
|
||||
|
||||
//============================================================================
|
||||
NetTrans::NetTrans (ENetProtocol protocol, ETransType transType)
|
||||
: m_state(kTransStateWaitServerConnect)
|
||||
, m_result(kNetPending)
|
||||
, m_transId(0)
|
||||
, m_connId(0)
|
||||
, m_protocol(protocol)
|
||||
, m_hasSubTrans(false)
|
||||
, m_transType(transType)
|
||||
{
|
||||
AtomicAdd(&s_perf[kPerfCurrTransactions], 1);
|
||||
AtomicAdd(&s_perfTransCount[m_transType], 1);
|
||||
// DebugMsg("%s@%p created", s_transTypes[m_transType], this);
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
NetTrans::~NetTrans () {
|
||||
ASSERT(!m_link.IsLinked());
|
||||
AtomicAdd(&s_perfTransCount[m_transType], -1);
|
||||
AtomicAdd(&s_perf[kPerfCurrTransactions], -1);
|
||||
// DebugMsg("%s@%p destroyed", s_transTypes[m_transType], this);
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
bool NetTrans::CanStart () const {
|
||||
switch (m_protocol) {
|
||||
case kNetProtocolCli2Auth: return AuthQueryConnected();
|
||||
case kNetProtocolCli2Game: return GameQueryConnected();
|
||||
case kNetProtocolCli2File: return FileQueryConnected();
|
||||
case kNetProtocolCli2Csr: return CsrQueryConnected();
|
||||
case kNetProtocolCli2GateKeeper: return GateKeeperQueryConnected();
|
||||
DEFAULT_FATAL(m_protocol);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Module functions
|
||||
*
|
||||
***/
|
||||
|
||||
//============================================================================
|
||||
void NetTransInitialize () {
|
||||
s_critsect.Enter();
|
||||
{
|
||||
s_running = true;
|
||||
}
|
||||
s_critsect.Leave();
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
void NetTransDestroy (bool wait) {
|
||||
s_critsect.Enter();
|
||||
{
|
||||
s_running = false;
|
||||
}
|
||||
s_critsect.Leave();
|
||||
|
||||
NetTransCancelAll(kNetErrRemoteShutdown);
|
||||
|
||||
if (!wait)
|
||||
return;
|
||||
|
||||
while (s_perf[kPerfCurrTransactions]) {
|
||||
NetTransUpdate();
|
||||
AsyncSleep(10);
|
||||
}
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
void NetTransSetTimeoutMs (unsigned ms) {
|
||||
s_timeoutMs = ms ? ms : kDefaultTimeoutMs;
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
unsigned NetTransGetTimeoutMs () {
|
||||
return s_timeoutMs;
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
void NetTransSend (NetTrans * trans) {
|
||||
trans->IncRef("Lifetime");
|
||||
s_critsect.Enter();
|
||||
{
|
||||
static unsigned s_transId;
|
||||
while (!trans->m_transId)
|
||||
trans->m_transId = ++s_transId;
|
||||
s_transactions.Link(trans, kListTail);
|
||||
if (!s_running)
|
||||
CancelTrans_CS(trans, kNetErrRemoteShutdown);
|
||||
}
|
||||
s_critsect.Leave();
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
bool NetTransRecv (unsigned transId, const byte msg[], unsigned bytes) {
|
||||
NetTrans * trans = FindTransIncRef(transId, "Recv");
|
||||
|
||||
if (!trans)
|
||||
return true; // transaction was canceled.
|
||||
|
||||
// Update the timeout time
|
||||
trans->m_timeoutAtMs = TimeGetMs() + s_timeoutMs;
|
||||
|
||||
bool result = trans->Recv(msg, bytes);
|
||||
|
||||
if (!result)
|
||||
NetTransCancel(transId, kNetErrInternalError);
|
||||
|
||||
trans->DecRef("Recv");
|
||||
return result;
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
void NetTransCancel (unsigned transId, ENetError error) {
|
||||
s_critsect.Enter();
|
||||
{
|
||||
NetTrans * trans = s_transactions.Head();
|
||||
for (; trans; trans = trans->m_link.Next()) {
|
||||
if (trans->m_transId == transId) {
|
||||
CancelTrans_CS(trans, error);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
s_critsect.Leave();
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
void NetTransCancelByProtocol (ENetProtocol protocol, ENetError error) {
|
||||
s_critsect.Enter();
|
||||
{
|
||||
NetTrans * trans = s_transactions.Head();
|
||||
for (; trans; trans = trans->m_link.Next()) {
|
||||
if (trans->m_protocol == protocol)
|
||||
CancelTrans_CS(trans, error);
|
||||
}
|
||||
}
|
||||
s_critsect.Leave();
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
void NetTransCancelByConnId (unsigned connId, ENetError error) {
|
||||
s_critsect.Enter();
|
||||
{
|
||||
NetTrans * trans = s_transactions.Head();
|
||||
for (; trans; trans = trans->m_link.Next()) {
|
||||
if (trans->m_connId == connId)
|
||||
CancelTrans_CS(trans, error);
|
||||
}
|
||||
}
|
||||
s_critsect.Leave();
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
void NetTransCancelAll (ENetError error) {
|
||||
s_critsect.Enter();
|
||||
{
|
||||
NetTrans * trans = s_transactions.Head();
|
||||
for (; trans; trans = trans->m_link.Next())
|
||||
CancelTrans_CS(trans, error);
|
||||
}
|
||||
s_critsect.Leave();
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
void NetTransUpdate () {
|
||||
LISTDECL(NetTrans, m_link) completed;
|
||||
LISTDECL(NetTrans, m_link) parentCompleted;
|
||||
|
||||
s_critsect.Enter();
|
||||
NetTrans * next, * trans = s_transactions.Head();
|
||||
for (; trans; trans = next) {
|
||||
next = s_transactions.Next(trans);
|
||||
|
||||
bool done = false;
|
||||
while (!done) {
|
||||
switch (trans->m_state) {
|
||||
case kTransStateComplete:
|
||||
if (trans->m_hasSubTrans)
|
||||
parentCompleted.Link(trans);
|
||||
else
|
||||
completed.Link(trans);
|
||||
done = true;
|
||||
break;
|
||||
|
||||
case kTransStateWaitServerConnect:
|
||||
if (!trans->CanStart()) {
|
||||
done = true;
|
||||
break;
|
||||
}
|
||||
if (trans->m_protocol && 0 == (trans->m_connId = ConnGetId(trans->m_protocol))) {
|
||||
done = true;
|
||||
break;
|
||||
}
|
||||
// This is the default "next state", trans->Send() can override this
|
||||
trans->m_state = kTransStateWaitServerResponse;
|
||||
// Set timeout time before calling Send(), allowing Send() to change it if it wants to.
|
||||
trans->m_timeoutAtMs = TimeGetMs() + s_timeoutMs;
|
||||
if (!trans->Send()) {
|
||||
// Revert back to current state so that we'll attempt to send again
|
||||
trans->m_state = kTransStateWaitServerConnect;
|
||||
done = true;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case kTransStateWaitServerResponse:
|
||||
// Check for timeout
|
||||
if ((int)(TimeGetMs() - trans->m_timeoutAtMs) > 0) {
|
||||
// Check to see if the transaction wants to "abort" the timeout
|
||||
if (trans->TimedOut())
|
||||
CancelTrans_CS(trans, kNetErrTimeout);
|
||||
else
|
||||
trans->m_timeoutAtMs = TimeGetMs() + s_timeoutMs; // Reset the timeout counter
|
||||
}
|
||||
done = true;
|
||||
break;
|
||||
|
||||
DEFAULT_FATAL(trans->m_state);
|
||||
}
|
||||
}
|
||||
}
|
||||
s_critsect.Leave();
|
||||
|
||||
// Post completed transactions
|
||||
while (NetTrans * trans = completed.Head()) {
|
||||
completed.Unlink(trans);
|
||||
trans->Post();
|
||||
trans->DecRef("Lifetime");
|
||||
}
|
||||
// Post completed parent transactions
|
||||
while (NetTrans * trans = parentCompleted.Head()) {
|
||||
parentCompleted.Unlink(trans);
|
||||
trans->Post();
|
||||
trans->DecRef("Lifetime");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // namespace Ngl
|
||||
/*==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/PubUtilLib/plNetGameLib/Private/plNglTrans.cpp
|
||||
*
|
||||
***/
|
||||
|
||||
#include "../Pch.h"
|
||||
#pragma hdrstop
|
||||
|
||||
|
||||
namespace Ngl {
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Private
|
||||
*
|
||||
***/
|
||||
|
||||
enum {
|
||||
kPerfCurrTransactions,
|
||||
kNumPerf
|
||||
};
|
||||
|
||||
static const unsigned kDefaultTimeoutMs = 5 * 60 * 1000;
|
||||
|
||||
static bool s_running;
|
||||
static CCritSect s_critsect;
|
||||
static LISTDECL(NetTrans, m_link) s_transactions;
|
||||
static long s_perf[kNumPerf];
|
||||
static unsigned s_timeoutMs = kDefaultTimeoutMs;
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Internal functions
|
||||
*
|
||||
***/
|
||||
|
||||
//============================================================================
|
||||
static NetTrans * FindTransIncRef_CS (unsigned transId, const char tag[]) {
|
||||
// There shouldn't be more than a few transactions; just do a linear scan
|
||||
for (NetTrans * trans = s_transactions.Head(); trans; trans = s_transactions.Next(trans))
|
||||
if (trans->m_transId == transId) {
|
||||
trans->IncRef(tag);
|
||||
return trans;
|
||||
}
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
static NetTrans * FindTransIncRef (unsigned transId, const char tag[]) {
|
||||
NetTrans * trans;
|
||||
s_critsect.Enter();
|
||||
{
|
||||
trans = FindTransIncRef_CS(transId, tag);
|
||||
}
|
||||
s_critsect.Leave();
|
||||
return trans;
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
static void CancelTrans_CS (NetTrans * trans, ENetError error) {
|
||||
ASSERT(IS_NET_ERROR(error));
|
||||
if (trans->m_state != kTransStateComplete) {
|
||||
trans->m_result = error;
|
||||
trans->m_state = kTransStateComplete;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* NetTrans implementation
|
||||
*
|
||||
***/
|
||||
|
||||
//============================================================================
|
||||
NetTrans::NetTrans (ENetProtocol protocol, ETransType transType)
|
||||
: m_state(kTransStateWaitServerConnect)
|
||||
, m_result(kNetPending)
|
||||
, m_transId(0)
|
||||
, m_connId(0)
|
||||
, m_protocol(protocol)
|
||||
, m_hasSubTrans(false)
|
||||
, m_transType(transType)
|
||||
{
|
||||
AtomicAdd(&s_perf[kPerfCurrTransactions], 1);
|
||||
AtomicAdd(&s_perfTransCount[m_transType], 1);
|
||||
// DebugMsg("%s@%p created", s_transTypes[m_transType], this);
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
NetTrans::~NetTrans () {
|
||||
ASSERT(!m_link.IsLinked());
|
||||
AtomicAdd(&s_perfTransCount[m_transType], -1);
|
||||
AtomicAdd(&s_perf[kPerfCurrTransactions], -1);
|
||||
// DebugMsg("%s@%p destroyed", s_transTypes[m_transType], this);
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
bool NetTrans::CanStart () const {
|
||||
switch (m_protocol) {
|
||||
case kNetProtocolCli2Auth: return AuthQueryConnected();
|
||||
case kNetProtocolCli2Game: return GameQueryConnected();
|
||||
case kNetProtocolCli2File: return FileQueryConnected();
|
||||
case kNetProtocolCli2Csr: return CsrQueryConnected();
|
||||
case kNetProtocolCli2GateKeeper: return GateKeeperQueryConnected();
|
||||
DEFAULT_FATAL(m_protocol);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Module functions
|
||||
*
|
||||
***/
|
||||
|
||||
//============================================================================
|
||||
void NetTransInitialize () {
|
||||
s_critsect.Enter();
|
||||
{
|
||||
s_running = true;
|
||||
}
|
||||
s_critsect.Leave();
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
void NetTransDestroy (bool wait) {
|
||||
s_critsect.Enter();
|
||||
{
|
||||
s_running = false;
|
||||
}
|
||||
s_critsect.Leave();
|
||||
|
||||
NetTransCancelAll(kNetErrRemoteShutdown);
|
||||
|
||||
if (!wait)
|
||||
return;
|
||||
|
||||
while (s_perf[kPerfCurrTransactions]) {
|
||||
NetTransUpdate();
|
||||
AsyncSleep(10);
|
||||
}
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
void NetTransSetTimeoutMs (unsigned ms) {
|
||||
s_timeoutMs = ms ? ms : kDefaultTimeoutMs;
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
unsigned NetTransGetTimeoutMs () {
|
||||
return s_timeoutMs;
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
void NetTransSend (NetTrans * trans) {
|
||||
trans->IncRef("Lifetime");
|
||||
s_critsect.Enter();
|
||||
{
|
||||
static unsigned s_transId;
|
||||
while (!trans->m_transId)
|
||||
trans->m_transId = ++s_transId;
|
||||
s_transactions.Link(trans, kListTail);
|
||||
if (!s_running)
|
||||
CancelTrans_CS(trans, kNetErrRemoteShutdown);
|
||||
}
|
||||
s_critsect.Leave();
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
bool NetTransRecv (unsigned transId, const byte msg[], unsigned bytes) {
|
||||
NetTrans * trans = FindTransIncRef(transId, "Recv");
|
||||
|
||||
if (!trans)
|
||||
return true; // transaction was canceled.
|
||||
|
||||
// Update the timeout time
|
||||
trans->m_timeoutAtMs = TimeGetMs() + s_timeoutMs;
|
||||
|
||||
bool result = trans->Recv(msg, bytes);
|
||||
|
||||
if (!result)
|
||||
NetTransCancel(transId, kNetErrInternalError);
|
||||
|
||||
trans->DecRef("Recv");
|
||||
return result;
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
void NetTransCancel (unsigned transId, ENetError error) {
|
||||
s_critsect.Enter();
|
||||
{
|
||||
NetTrans * trans = s_transactions.Head();
|
||||
for (; trans; trans = trans->m_link.Next()) {
|
||||
if (trans->m_transId == transId) {
|
||||
CancelTrans_CS(trans, error);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
s_critsect.Leave();
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
void NetTransCancelByProtocol (ENetProtocol protocol, ENetError error) {
|
||||
s_critsect.Enter();
|
||||
{
|
||||
NetTrans * trans = s_transactions.Head();
|
||||
for (; trans; trans = trans->m_link.Next()) {
|
||||
if (trans->m_protocol == protocol)
|
||||
CancelTrans_CS(trans, error);
|
||||
}
|
||||
}
|
||||
s_critsect.Leave();
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
void NetTransCancelByConnId (unsigned connId, ENetError error) {
|
||||
s_critsect.Enter();
|
||||
{
|
||||
NetTrans * trans = s_transactions.Head();
|
||||
for (; trans; trans = trans->m_link.Next()) {
|
||||
if (trans->m_connId == connId)
|
||||
CancelTrans_CS(trans, error);
|
||||
}
|
||||
}
|
||||
s_critsect.Leave();
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
void NetTransCancelAll (ENetError error) {
|
||||
s_critsect.Enter();
|
||||
{
|
||||
NetTrans * trans = s_transactions.Head();
|
||||
for (; trans; trans = trans->m_link.Next())
|
||||
CancelTrans_CS(trans, error);
|
||||
}
|
||||
s_critsect.Leave();
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
void NetTransUpdate () {
|
||||
LISTDECL(NetTrans, m_link) completed;
|
||||
LISTDECL(NetTrans, m_link) parentCompleted;
|
||||
|
||||
s_critsect.Enter();
|
||||
NetTrans * next, * trans = s_transactions.Head();
|
||||
for (; trans; trans = next) {
|
||||
next = s_transactions.Next(trans);
|
||||
|
||||
bool done = false;
|
||||
while (!done) {
|
||||
switch (trans->m_state) {
|
||||
case kTransStateComplete:
|
||||
if (trans->m_hasSubTrans)
|
||||
parentCompleted.Link(trans);
|
||||
else
|
||||
completed.Link(trans);
|
||||
done = true;
|
||||
break;
|
||||
|
||||
case kTransStateWaitServerConnect:
|
||||
if (!trans->CanStart()) {
|
||||
done = true;
|
||||
break;
|
||||
}
|
||||
if (trans->m_protocol && 0 == (trans->m_connId = ConnGetId(trans->m_protocol))) {
|
||||
done = true;
|
||||
break;
|
||||
}
|
||||
// This is the default "next state", trans->Send() can override this
|
||||
trans->m_state = kTransStateWaitServerResponse;
|
||||
// Set timeout time before calling Send(), allowing Send() to change it if it wants to.
|
||||
trans->m_timeoutAtMs = TimeGetMs() + s_timeoutMs;
|
||||
if (!trans->Send()) {
|
||||
// Revert back to current state so that we'll attempt to send again
|
||||
trans->m_state = kTransStateWaitServerConnect;
|
||||
done = true;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case kTransStateWaitServerResponse:
|
||||
// Check for timeout
|
||||
if ((int)(TimeGetMs() - trans->m_timeoutAtMs) > 0) {
|
||||
// Check to see if the transaction wants to "abort" the timeout
|
||||
if (trans->TimedOut())
|
||||
CancelTrans_CS(trans, kNetErrTimeout);
|
||||
else
|
||||
trans->m_timeoutAtMs = TimeGetMs() + s_timeoutMs; // Reset the timeout counter
|
||||
}
|
||||
done = true;
|
||||
break;
|
||||
|
||||
DEFAULT_FATAL(trans->m_state);
|
||||
}
|
||||
}
|
||||
}
|
||||
s_critsect.Leave();
|
||||
|
||||
// Post completed transactions
|
||||
while (NetTrans * trans = completed.Head()) {
|
||||
completed.Unlink(trans);
|
||||
trans->Post();
|
||||
trans->DecRef("Lifetime");
|
||||
}
|
||||
// Post completed parent transactions
|
||||
while (NetTrans * trans = parentCompleted.Head()) {
|
||||
parentCompleted.Unlink(trans);
|
||||
trans->Post();
|
||||
trans->DecRef("Lifetime");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // namespace Ngl
|
||||
|
Reference in New Issue
Block a user