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

Get rid of pnUtW32Addr and make IP strings char*s.

IP addresses don't need to be unicode.
pnUtAddr is still around until we replace all NetAddress uses with
plNetAddress (they are typedef'ed to each other right now).
This commit is contained in:
Darryl Pogue
2012-03-26 21:27:55 -07:00
parent 06a561fc85
commit 3ea3473d13
27 changed files with 166 additions and 329 deletions

View File

@ -90,7 +90,7 @@ struct CliAuConn : AtomicRef {
LINK(CliAuConn) link;
AsyncSocket sock;
NetCli * cli;
wchar_t name[MAX_PATH];
char name[MAX_PATH];
plNetAddress addr;
Uuid token;
unsigned seq;
@ -197,7 +197,7 @@ struct AgeRequestTrans : NetAuthTrans {
unsigned m_ageMcpId;
Uuid m_ageInstId;
unsigned m_ageVaultId;
NetAddressNode m_gameSrvNode;
uint32_t m_gameSrvNode;
AgeRequestTrans (
const wchar_t ageName[],
@ -1527,7 +1527,7 @@ static void Connect (
//============================================================================
static void Connect (
const wchar_t name[],
const char name[],
const NetAddress & addr
) {
ASSERT(s_running);
@ -1536,7 +1536,7 @@ static void Connect (
conn->addr = addr;
conn->seq = ConnNextSequence();
conn->lastHeardTimeMs = GetNonZeroTimeMs(); // used in connect timeout, and ping timeout
StrCopy(conn->name, name, arrsize(conn->name));
strncpy(conn->name, name, arrsize(conn->name));
conn->IncRef("Lifetime");
conn->AutoReconnect();
@ -1545,7 +1545,7 @@ static void Connect (
//============================================================================
static void AsyncLookupCallback (
void * param,
const wchar_t name[],
const char name[],
unsigned addrCount,
const plNetAddress addrs[]
) {
@ -5121,8 +5121,8 @@ void AuthPingEnable (bool enable) {
//============================================================================
void NetCliAuthStartConnect (
const wchar_t * authAddrList[],
unsigned authAddrCount
const char* authAddrList[],
uint32_t authAddrCount
) {
// TEMP: Only connect to one auth server until we fill out this module
// to choose the "best" auth connection.
@ -5130,7 +5130,7 @@ void NetCliAuthStartConnect (
for (unsigned i = 0; i < authAddrCount; ++i) {
// Do we need to lookup the address?
const wchar_t * name = authAddrList[i];
const char* name = authAddrList[i];
while (unsigned ch = *name) {
++name;
if (!(isdigit(ch) || ch == L'.' || ch == L':')) {
@ -5146,8 +5146,7 @@ void NetCliAuthStartConnect (
}
}
if (!name[0]) {
NetAddress addr;
NetAddressFromString(&addr, authAddrList[i], kNetDefaultClientPort);
NetAddress addr(authAddrList[i], kNetDefaultClientPort);
Connect(authAddrList[i], addr);
}
}

View File

@ -62,8 +62,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
// Connect
//============================================================================
void NetCliAuthStartConnect (
const wchar_t * authAddrList[],
unsigned authAddrCount
const char* authAddrList[],
uint32_t authAddrCount
);
bool NetCliAuthQueryConnected ();
void NetCliAuthAutoReconnectEnable (bool enable); // is enabled by default

View File

@ -413,7 +413,7 @@ static void Connect (
//============================================================================
static void AsyncLookupCallback (
void * param,
const wchar_t name[],
const char name[],
unsigned addrCount,
const NetAddress addrs[]
) {
@ -830,8 +830,8 @@ unsigned CsrGetConnId () {
//============================================================================
void NetCliCsrStartConnect (
const wchar_t * addrList[],
unsigned addrCount,
const char* addrList[],
uint32_t addrCount,
FNetCliCsrConnectedCallback callback,
void * param
) {
@ -840,7 +840,7 @@ void NetCliCsrStartConnect (
for (unsigned i = 0; i < addrCount; ++i) {
// Do we need to lookup the address?
const wchar_t * name = addrList[i];
const char* name = addrList[i];
while (unsigned ch = *name) {
++name;
if (!(isdigit(ch) || ch == L'.' || ch == L':')) {
@ -860,8 +860,7 @@ void NetCliCsrStartConnect (
}
}
if (!name[0]) {
NetAddress addr;
NetAddressFromString(&addr, addrList[i], kNetDefaultClientPort);
NetAddress addr(addrList[i], kNetDefaultClientPort);
ConnectParam * cp = new ConnectParam;
cp->callback = callback;

View File

@ -62,8 +62,8 @@ typedef void (*FNetCliCsrConnectedCallback) (
unsigned latestBuildId
);
void NetCliCsrStartConnect (
const wchar_t * addrList[],
unsigned addrCount,
const char* addrList[],
uint32_t addrCount,
FNetCliCsrConnectedCallback callback = nil,
void * param = nil
);

View File

@ -64,7 +64,7 @@ struct CliFileConn : AtomicRef {
LINK(CliFileConn) link;
CLock sockLock; // to protect the socket pointer so we don't nuke it while using it
AsyncSocket sock;
wchar_t name[MAX_PATH];
char name[MAX_PATH];
NetAddress addr;
unsigned seq;
ARRAY(uint8_t) recvBuffer;
@ -539,13 +539,13 @@ static void Connect (CliFileConn * conn) {
//============================================================================
static void Connect (
const wchar_t name[],
const char name[],
const NetAddress & addr
) {
ASSERT(s_running);
CliFileConn * conn = NEWZERO(CliFileConn);
StrCopy(conn->name, name, arrsize(conn->name));
strncpy(conn->name, name, arrsize(conn->name));
conn->addr = addr;
conn->buildId = s_connectBuildId;
conn->serverType = s_serverType;
@ -559,7 +559,7 @@ static void Connect (
//============================================================================
static void AsyncLookupCallback (
void * param,
const wchar_t name[],
const char name[],
unsigned addrCount,
const NetAddress addrs[]
) {
@ -1334,8 +1334,8 @@ unsigned FileGetConnId () {
//============================================================================
void NetCliFileStartConnect (
const wchar_t * fileAddrList[],
unsigned fileAddrCount,
const char* fileAddrList[],
uint32_t fileAddrCount,
bool isPatcher /* = false */
) {
// TEMP: Only connect to one file server until we fill out this module
@ -1346,7 +1346,7 @@ void NetCliFileStartConnect (
for (unsigned i = 0; i < fileAddrCount; ++i) {
// Do we need to lookup the address?
const wchar_t * name = fileAddrList[i];
const char* name = fileAddrList[i];
while (unsigned ch = *name) {
++name;
if (!(isdigit(ch) || ch == L'.' || ch == L':')) {
@ -1362,8 +1362,7 @@ void NetCliFileStartConnect (
}
}
if (!name[0]) {
NetAddress addr;
NetAddressFromString(&addr, fileAddrList[i], kNetDefaultClientPort);
NetAddress addr(fileAddrList[i], kNetDefaultClientPort);
Connect(fileAddrList[i], addr);
}
}
@ -1371,8 +1370,8 @@ void NetCliFileStartConnect (
//============================================================================
void NetCliFileStartConnectAsServer (
const wchar_t * fileAddrList[],
unsigned fileAddrCount,
const char* fileAddrList[],
uint32_t fileAddrCount,
unsigned serverType,
unsigned serverBuildId
) {
@ -1384,7 +1383,7 @@ void NetCliFileStartConnectAsServer (
for (unsigned i = 0; i < fileAddrCount; ++i) {
// Do we need to lookup the address?
const wchar_t * name = fileAddrList[i];
const char* name = fileAddrList[i];
while (unsigned ch = *name) {
++name;
if (!(isdigit(ch) || ch == L'.' || ch == L':')) {
@ -1400,8 +1399,7 @@ void NetCliFileStartConnectAsServer (
}
}
if (!name[0]) {
NetAddress addr;
NetAddressFromString(&addr, fileAddrList[i], kNetDefaultServerPort);
NetAddress addr(fileAddrList[i], kNetDefaultServerPort);
Connect(fileAddrList[i], addr);
}
}

View File

@ -62,12 +62,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
// Connect
//============================================================================
void NetCliFileStartConnect (
const wchar_t * fileAddrList[],
const char* fileAddrList[],
unsigned fileAddrCount,
bool isPatcher = false
);
void NetCliFileStartConnectAsServer (
const wchar_t * fileAddrList[],
const char* fileAddrList[],
unsigned fileAddrCount,
unsigned serverType,
unsigned serverBuildId

View File

@ -796,7 +796,7 @@ void GamePingEnable (bool enable) {
//============================================================================
void NetCliGameStartConnect (
const NetAddressNode & node
const uint32_t node
) {
plNetAddress addr(node, kNetDefaultClientPort);
Connect(addr);

View File

@ -61,7 +61,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
// Connect
//============================================================================
void NetCliGameStartConnect (
const NetAddressNode & node
const uint32_t node
);
//============================================================================

View File

@ -89,7 +89,7 @@ struct CliGkConn : AtomicRef {
LINK(CliGkConn) link;
AsyncSocket sock;
NetCli * cli;
wchar_t name[MAX_PATH];
char name[MAX_PATH];
NetAddress addr;
Uuid token;
unsigned seq;
@ -463,7 +463,7 @@ static void Connect (
//============================================================================
static void Connect (
const wchar_t name[],
const char name[],
const NetAddress & addr
) {
ASSERT(s_running);
@ -472,7 +472,7 @@ static void Connect (
conn->addr = addr;
conn->seq = ConnNextSequence();
conn->lastHeardTimeMs = GetNonZeroTimeMs(); // used in connect timeout, and ping timeout
StrCopy(conn->name, name, arrsize(conn->name));
strncpy(conn->name, name, arrsize(conn->name));
conn->IncRef("Lifetime");
conn->AutoReconnect();
@ -481,7 +481,7 @@ static void Connect (
//============================================================================
static void AsyncLookupCallback (
void * param,
const wchar_t name[],
const char name[],
unsigned addrCount,
const NetAddress addrs[]
) {
@ -1053,14 +1053,14 @@ unsigned GateKeeperGetConnId () {
//============================================================================
void NetCliGateKeeperStartConnect (
const wchar_t * gateKeeperAddrList[],
unsigned gateKeeperAddrCount
const char* gateKeeperAddrList[],
uint32_t gateKeeperAddrCount
) {
gateKeeperAddrCount = min(gateKeeperAddrCount, 1);
for (unsigned i = 0; i < gateKeeperAddrCount; ++i) {
// Do we need to lookup the address?
const wchar_t * name = gateKeeperAddrList[i];
const char* name = gateKeeperAddrList[i];
while (unsigned ch = *name) {
++name;
if (!(isdigit(ch) || ch == L'.' || ch == L':')) {
@ -1076,8 +1076,7 @@ void NetCliGateKeeperStartConnect (
}
}
if (!name[0]) {
NetAddress addr;
NetAddressFromString(&addr, gateKeeperAddrList[i], kNetDefaultClientPort);
NetAddress addr(gateKeeperAddrList[i], kNetDefaultClientPort);
Connect(gateKeeperAddrList[i], addr);
}
}

View File

@ -62,8 +62,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
// Connect
//============================================================================
void NetCliGateKeeperStartConnect (
const wchar_t * gateKeeperAddrList[],
unsigned gateKeeperAddrCount
const char* gateKeeperAddrList[],
uint32_t gateKeeperAddrCount
);
bool NetCliGateKeeperQueryConnected ();