Browse Source

Completely kill pnUtAddr and NetAddress.

Darryl Pogue 13 years ago
parent
commit
3ba721711e
  1. 2
      Sources/Plasma/FeatureLib/pfCsrSrv/pfCsrSrv.cpp
  2. 6
      Sources/Plasma/NucleusLib/pnAsyncCore/Private/pnAcIo.h
  3. 6
      Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/Nt/pnAceNtInt.h
  4. 31
      Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/Nt/pnAceNtSocket.cpp
  5. 6
      Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/W9x/pnAceW9xInt.h
  6. 6
      Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/W9x/pnAceW9xSocket.cpp
  7. 9
      Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/Win32/pnAceW32Dns.cpp
  8. 6
      Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/pnAceInt.h
  9. 6
      Sources/Plasma/NucleusLib/pnAsyncCoreExe/pnAceIo.cpp
  10. 1
      Sources/Plasma/NucleusLib/pnUtils/CMakeLists.txt
  11. 57
      Sources/Plasma/NucleusLib/pnUtils/pnUtAddr.h
  12. 1
      Sources/Plasma/NucleusLib/pnUtils/pnUtAllIncludes.h
  13. 4
      Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAuth.cpp
  14. 10
      Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglCsr.cpp
  15. 10
      Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglFile.cpp
  16. 4
      Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGame.cpp
  17. 8
      Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGateKeeper.cpp

2
Sources/Plasma/FeatureLib/pfCsrSrv/pfCsrSrv.cpp

@ -113,7 +113,7 @@ static bool QueryAccept (
void * ,
unsigned channel,
SimpleNetConn * ,
const NetAddress & addr
const plNetAddress& addr
) {
plString str = addr.AsString();
LogMsg(kLogPerf, L"pfCsrSrv: Accepted connection from %s", str.c_str());

6
Sources/Plasma/NucleusLib/pnAsyncCore/Private/pnAcIo.h

@ -103,8 +103,8 @@ struct AsyncNotifySocket {
};
struct AsyncNotifySocketConnect : AsyncNotifySocket {
NetAddress localAddr;
NetAddress remoteAddr;
plNetAddress localAddr;
plNetAddress remoteAddr;
unsigned connType;
};
@ -113,7 +113,7 @@ struct AsyncNotifySocketListen : AsyncNotifySocketConnect {
unsigned buildType;
unsigned branchId;
Uuid productId;
NetAddress addr;
plNetAddress addr;
uint8_t * buffer;
unsigned bytes;
unsigned bytesProcessed;

6
Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/Nt/pnAceNtInt.h

@ -191,7 +191,7 @@ void NtWaitForShutdown ();
void NtSleep (unsigned sleepMs);
void NtSocketConnect (
AsyncCancelId * cancelId,
const NetAddress & netAddr,
const plNetAddress& netAddr,
FAsyncNotifySocketProc notifyProc,
void * param,
const void * sendData,
@ -228,11 +228,11 @@ void NtSocketSetBacklogAlloc (
unsigned bufferSize
);
unsigned NtSocketStartListening (
const NetAddress & listenAddr,
const plNetAddress& listenAddr,
FAsyncNotifySocketProc notifyProc
);
void NtSocketStopListening (
const NetAddress & listenAddr,
const plNetAddress& listenAddr,
FAsyncNotifySocketProc notifyProc
);
void NtSocketEnableNagling (

31
Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/Nt/pnAceNtSocket.cpp

@ -77,7 +77,7 @@ static const unsigned kMinBacklogBytes = 4 * 1024;
struct NtListener {
LINK(NtListener) nextPort;
SOCKET hSocket;
NetAddress addr;
plNetAddress addr;
FAsyncNotifySocketProc notifyProc;
int listenCount;
@ -91,7 +91,7 @@ struct NtOpConnAttempt : Operation {
AsyncCancelId cancelId;
bool canceled;
unsigned localPort;
NetAddress remoteAddr;
plNetAddress remoteAddr;
FAsyncNotifySocketProc notifyProc;
void * param;
SOCKET hSocket;
@ -113,7 +113,7 @@ struct NtOpSocketRead : Operation {
struct NtSock : NtObject {
LINK(NtSock) link;
NetAddress addr;
plNetAddress addr;
unsigned closeTimeMs;
unsigned connType;
FAsyncNotifySocketProc notifyProc;
@ -171,7 +171,7 @@ NtSock::~NtSock () {
//===========================================================================
// must be called inside s_listenCrit
static bool ListenPortIncrement (
const NetAddress & listenAddr,
const plNetAddress& listenAddr,
FAsyncNotifySocketProc notifyProc,
int count
) {
@ -192,12 +192,11 @@ static bool ListenPortIncrement (
//===========================================================================
static void SocketGetAddresses (
NtSock * sock,
NetAddress * localAddr,
NetAddress * remoteAddr
plNetAddress* localAddr,
plNetAddress* remoteAddr
) {
// NetAddress may be bigger than sockaddr_in so start by zeroing the whole thing
memset(localAddr, 0, sizeof(*localAddr));
memset(remoteAddr, 0, sizeof(*remoteAddr));
localAddr->Clear();
remoteAddr->Clear();
// don't have to enter critsect or validate socket before referencing it
// because this routine is called before the user has a chance to close it
@ -470,7 +469,7 @@ static bool SocketInitConnect (
//===========================================================================
static void SocketInitListen (
NtSock * const sock,
const NetAddress & listenAddr,
const plNetAddress& listenAddr,
FAsyncNotifySocketProc notifyProc
) {
for (;;) {
@ -509,7 +508,7 @@ static void SocketInitListen (
}
//===========================================================================
static SOCKET ListenSocket (NetAddress * listenAddr) {
static SOCKET ListenSocket(plNetAddress* listenAddr) {
// create a new socket to listen
SOCKET s;
if (INVALID_SOCKET == (s = socket(AF_INET, SOCK_STREAM, 0))) {
@ -612,7 +611,7 @@ static void ListenPrepareListeners (fd_set * readfds) {
}
//===========================================================================
static SOCKET ConnectSocket (unsigned localPort, const NetAddress & addr) {
static SOCKET ConnectSocket (unsigned localPort, const plNetAddress& addr) {
SOCKET s;
if (INVALID_SOCKET == (s = socket(AF_INET, SOCK_STREAM, 0))) {
LogMsg(kLogError, "socket create failed");
@ -1126,12 +1125,12 @@ bool INtSocketOpCompleteQueuedSocketWrite (
//===========================================================================
unsigned NtSocketStartListening (
const NetAddress & listenAddr,
const plNetAddress& listenAddr,
FAsyncNotifySocketProc notifyProc
) {
s_listenCrit.Enter();
StartListenThread();
NetAddress addr = listenAddr;
plNetAddress addr = listenAddr;
for (;;) {
// if the port is already open then just increment the reference count
if (ListenPortIncrement(addr, notifyProc, 1))
@ -1160,7 +1159,7 @@ unsigned NtSocketStartListening (
//===========================================================================
void NtSocketStopListening (
const NetAddress & listenAddr,
const plNetAddress& listenAddr,
FAsyncNotifySocketProc notifyProc
) {
s_listenCrit.Enter();
@ -1171,7 +1170,7 @@ void NtSocketStopListening (
//===========================================================================
void NtSocketConnect (
AsyncCancelId * cancelId,
const NetAddress & netAddr,
const plNetAddress& netAddr,
FAsyncNotifySocketProc notifyProc,
void * param,
const void * sendData,

6
Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/W9x/pnAceW9xInt.h

@ -88,7 +88,7 @@ bool W9xThreadWaitId (
);
void W9xSocketConnect (
AsyncCancelId * cancelId,
const NetAddress & netAddr,
const plNetAddress& netAddr,
FAsyncNotifySocketProc notifyProc,
void * param,
const void * sendData,
@ -126,11 +126,11 @@ void W9xSocketSetBacklogAlloc (
unsigned bufferSize
);
unsigned W9xSocketStartListening (
const NetAddress & listenAddr,
const plNetAddress& listenAddr,
FAsyncNotifySocketProc notifyProc
);
void W9xSocketStopListening (
const NetAddress & listenAddr,
const plNetAddress& listenAddr,
FAsyncNotifySocketProc notifyProc
);
void W9xSocketEnableNagling (

6
Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/W9x/pnAceW9xSocket.cpp

@ -999,7 +999,7 @@ static LRESULT CALLBACK WndProc (
//===========================================================================
void W9xSocketConnect (
AsyncCancelId * cancelId,
const NetAddress & netAddr,
const plNetAddress& netAddr,
FAsyncNotifySocketProc notifyProc,
void * param,
const void * sendData,
@ -1148,7 +1148,7 @@ void W9xSocketDisconnect (
//===========================================================================
unsigned W9xSocketStartListening (
const NetAddress & listenAddr,
const plNetAddress& listenAddr,
FAsyncNotifySocketProc notifyProc
) {
return 0;
@ -1157,7 +1157,7 @@ unsigned W9xSocketStartListening (
//===========================================================================
void W9xSocketStopListening (
const NetAddress & listenAddr,
const plNetAddress& listenAddr,
FAsyncNotifySocketProc notifyProc
) {
}

9
Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/Win32/pnAceW32Dns.cpp

@ -89,7 +89,7 @@ static unsigned s_nextLookupCancelId = 1;
//===========================================================================
static void LookupProcess (Lookup * lookup, unsigned error) {
unsigned count = 0;
NetAddress * addrs = nil;
plNetAddress* addrs = nil;
if (error)
return;
@ -109,8 +109,7 @@ static void LookupProcess (Lookup * lookup, unsigned error) {
++count;
// allocate a buffer large enough to hold all the addresses
addrs = (NetAddress *)malloc(sizeof(*addrs) * count);
memset(addrs, 0, sizeof(*addrs) * count);
addrs = new plNetAddress[count];
// fill in address data
const uint16_t port = htons((uint16_t) lookup->port);
@ -134,7 +133,7 @@ static void LookupProcess (Lookup * lookup, unsigned error) {
delete lookup;
PerfSubCounter(kAsyncPerfNameLookupAttemptsCurr, 1);
free(addrs);
delete[] addrs;
}
//===========================================================================
@ -326,7 +325,7 @@ void AsyncAddressLookupName (
void AsyncAddressLookupAddr (
AsyncCancelId * cancelId, // out
FAsyncLookupProc lookupProc,
const NetAddress & address,
const plNetAddress& address,
void * param
) {
ASSERT(lookupProc);

6
Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/pnAceInt.h

@ -106,7 +106,7 @@ typedef void (* FSleep) (unsigned sleepMs);
// Sockets
typedef void (* FAsyncSocketConnect) (
AsyncCancelId * cancelId,
const NetAddress & netAddr,
const plNetAddress& netAddr,
FAsyncNotifySocketProc notifyProc,
void * param,
const void * sendData,
@ -151,12 +151,12 @@ typedef void (* FAsyncSocketSetBacklogAlloc) (
);
typedef unsigned (* FAsyncSocketStartListening) (
const NetAddress & listenAddr,
const plNetAddress& listenAddr,
FAsyncNotifySocketProc notifyProc
);
typedef void (* FAsyncSocketStopListening) (
const NetAddress & listenAddr,
const plNetAddress& listenAddr,
FAsyncNotifySocketProc notifyProc
);

6
Sources/Plasma/NucleusLib/pnAsyncCoreExe/pnAceIo.cpp

@ -206,7 +206,7 @@ static unsigned GetConnHash (
//===========================================================================
void AsyncSocketConnect (
AsyncCancelId * cancelId,
const NetAddress & netAddr,
const plNetAddress& netAddr,
FAsyncNotifySocketProc notifyProc,
void * param,
const void * sendData,
@ -293,7 +293,7 @@ void AsyncSocketSetBacklogAlloc (
//===========================================================================
unsigned AsyncSocketStartListening (
const NetAddress & listenAddr,
const plNetAddress& listenAddr,
FAsyncNotifySocketProc notifyProc
) {
ASSERT(g_api.socketStartListening);
@ -302,7 +302,7 @@ unsigned AsyncSocketStartListening (
//===========================================================================
void AsyncSocketStopListening (
const NetAddress & listenAddr,
const plNetAddress& listenAddr,
FAsyncNotifySocketProc notifyProc
) {
ASSERT(g_api.socketStopListening);

1
Sources/Plasma/NucleusLib/pnUtils/CMakeLists.txt

@ -5,7 +5,6 @@ set(pnUtils_HEADERS
Pch.h
pnUtils.h
pnUtCoreLib.h
pnUtAddr.h
pnUtAllIncludes.h
pnUtArray.h
pnUtCmd.h

57
Sources/Plasma/NucleusLib/pnUtils/pnUtAddr.h

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

1
Sources/Plasma/NucleusLib/pnUtils/pnUtAllIncludes.h

@ -51,7 +51,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "pnUtCoreLib.h" // must be first in list
#include "pnUtPragma.h"
#include "pnUtAddr.h"
#include "pnUtUuid.h"
#include "pnUtSort.h"
#include "pnUtArray.h"

4
Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAuth.cpp

@ -1528,7 +1528,7 @@ static void Connect (
//============================================================================
static void Connect (
const char name[],
const NetAddress & addr
const plNetAddress& addr
) {
ASSERT(s_running);
@ -5146,7 +5146,7 @@ void NetCliAuthStartConnect (
}
}
if (!name[0]) {
NetAddress addr(authAddrList[i], kNetDefaultClientPort);
plNetAddress addr(authAddrList[i], kNetDefaultClientPort);
Connect(authAddrList[i], addr);
}
}

10
Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglCsr.cpp

@ -73,7 +73,7 @@ struct CliCsConn : AtomicRef {
AsyncSocket sock;
AsyncCancelId cancelId;
NetCli * cli;
NetAddress addr;
plNetAddress addr;
unsigned seq;
bool abandoned;
unsigned serverChallenge;
@ -369,7 +369,7 @@ static bool SocketNotifyCallback (
//============================================================================
static void Connect (
const NetAddress & addr,
const plNetAddress& addr,
ConnectParam * cp
) {
CliCsConn * conn = NEWZERO(CliCsConn);
@ -415,7 +415,7 @@ static void AsyncLookupCallback (
void * param,
const char name[],
unsigned addrCount,
const NetAddress addrs[]
const plNetAddress addrs[]
) {
if (!addrCount) {
ReportNetError(kNetProtocolCli2Auth, kNetErrNameLookupFailed);
@ -860,8 +860,8 @@ void NetCliCsrStartConnect (
}
}
if (!name[0]) {
NetAddress addr(addrList[i], kNetDefaultClientPort);
plNetAddress addr(addrList[i], kNetDefaultClientPort);
ConnectParam * cp = new ConnectParam;
cp->callback = callback;
cp->param = param;

10
Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglFile.cpp

@ -65,7 +65,7 @@ struct CliFileConn : AtomicRef {
CLock sockLock; // to protect the socket pointer so we don't nuke it while using it
AsyncSocket sock;
char name[MAX_PATH];
NetAddress addr;
plNetAddress addr;
unsigned seq;
ARRAY(uint8_t) recvBuffer;
AsyncCancelId cancelId;
@ -540,7 +540,7 @@ static void Connect (CliFileConn * conn) {
//============================================================================
static void Connect (
const char name[],
const NetAddress & addr
const plNetAddress& addr
) {
ASSERT(s_running);
@ -561,7 +561,7 @@ static void AsyncLookupCallback (
void * param,
const char name[],
unsigned addrCount,
const NetAddress addrs[]
const plNetAddress addrs[]
) {
if (!addrCount) {
ReportNetError(kNetProtocolCli2File, kNetErrNameLookupFailed);
@ -1362,7 +1362,7 @@ void NetCliFileStartConnect (
}
}
if (!name[0]) {
NetAddress addr(fileAddrList[i], kNetDefaultClientPort);
plNetAddress addr(fileAddrList[i], kNetDefaultClientPort);
Connect(fileAddrList[i], addr);
}
}
@ -1399,7 +1399,7 @@ void NetCliFileStartConnectAsServer (
}
}
if (!name[0]) {
NetAddress addr(fileAddrList[i], kNetDefaultServerPort);
plNetAddress addr(fileAddrList[i], kNetDefaultServerPort);
Connect(fileAddrList[i], addr);
}
}

4
Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGame.cpp

@ -62,7 +62,7 @@ struct CliGmConn : AtomicRef {
AsyncSocket sock;
AsyncCancelId cancelId;
NetCli * cli;
NetAddress addr;
plNetAddress addr;
unsigned seq;
bool abandoned;
@ -354,7 +354,7 @@ static bool SocketNotifyCallback (
//============================================================================
static void Connect (
const NetAddress & addr
const plNetAddress& addr
) {
CliGmConn * conn = NEWZERO(CliGmConn);
conn->addr = addr;

8
Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGateKeeper.cpp

@ -90,7 +90,7 @@ struct CliGkConn : AtomicRef {
AsyncSocket sock;
NetCli * cli;
char name[MAX_PATH];
NetAddress addr;
plNetAddress addr;
Uuid token;
unsigned seq;
unsigned serverChallenge;
@ -464,7 +464,7 @@ static void Connect (
//============================================================================
static void Connect (
const char name[],
const NetAddress & addr
const plNetAddress& addr
) {
ASSERT(s_running);
@ -483,7 +483,7 @@ static void AsyncLookupCallback (
void * param,
const char name[],
unsigned addrCount,
const NetAddress addrs[]
const plNetAddress addrs[]
) {
if (!addrCount) {
ReportNetError(kNetProtocolCli2GateKeeper, kNetErrNameLookupFailed);
@ -1076,7 +1076,7 @@ void NetCliGateKeeperStartConnect (
}
}
if (!name[0]) {
NetAddress addr(gateKeeperAddrList[i], kNetDefaultClientPort);
plNetAddress addr(gateKeeperAddrList[i], kNetDefaultClientPort);
Connect(gateKeeperAddrList[i], addr);
}
}

Loading…
Cancel
Save