1
0
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-18 03:09:13 +00:00

Replace Uuid with plUUID EVERYWHERE.

This commit is contained in:
Darryl Pogue
2012-12-29 02:05:23 -08:00
parent a0641ba66b
commit bcf6e97d23
78 changed files with 427 additions and 892 deletions

View File

@ -51,6 +51,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNASYNCCORE_PRIVATE_PNACIO_H
#include "pnNetCommon/plNetAddress.h"
#include "pnUUID/pnUUID.h"
/****************************************************************************
@ -79,7 +80,7 @@ struct AsyncSocketConnectPacket {
uint32_t buildId;
uint32_t buildType;
uint32_t branchId;
Uuid productId;
plUUID productId;
};
#pragma pack(pop)
@ -114,7 +115,7 @@ struct AsyncNotifySocketListen : AsyncNotifySocketConnect {
unsigned buildId;
unsigned buildType;
unsigned branchId;
Uuid productId;
plUUID productId;
plNetAddress addr;
uint8_t * buffer;
unsigned bytes;
@ -183,7 +184,7 @@ void AsyncSocketRegisterNotifyProc (
unsigned buildId = 0,
unsigned buildType = 0,
unsigned branchId = 0,
const Uuid & productId = kNilGuid
const plUUID& productId = kNilUuid
);
void AsyncSocketUnregisterNotifyProc (
@ -192,7 +193,7 @@ void AsyncSocketUnregisterNotifyProc (
unsigned buildId = 0,
unsigned buildType = 0,
unsigned branchId = 0,
const Uuid & productId = kNilGuid
const plUUID& productId = kNilUuid
);
FAsyncNotifySocketProc AsyncSocketFindNotifyProc (
@ -203,7 +204,7 @@ FAsyncNotifySocketProc AsyncSocketFindNotifyProc (
unsigned * buildId,
unsigned * buildType,
unsigned * branchId,
Uuid * productId
plUUID* productId
);

View File

@ -62,7 +62,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
// uint32_t buildId; [optional]
// uint32_t branchId; [optional]
// uint32_t buildType; [optional]
// Uuid productId; [optional]
// plUUID productId; [optional]
const unsigned kConnHashFlagsIgnore = 0x01;
const unsigned kConnHashFlagsExactMatch = 0x02;
struct ISocketConnHash {
@ -70,7 +70,7 @@ struct ISocketConnHash {
unsigned buildId;
unsigned buildType;
unsigned branchId;
Uuid productId;
plUUID productId;
unsigned flags;
unsigned GetHash () const;
@ -102,7 +102,7 @@ unsigned ISocketConnHash::GetHash () const {
hash.Hash32(buildType);
if (branchId)
hash.Hash32(branchId);
if (productId != kNilGuid)
if (productId != kNilUuid)
hash.Hash(&productId, sizeof(productId));
*/
return hash.GetHash();
@ -145,7 +145,7 @@ bool ISocketConnHash::operator== (const ISocketConnHash & rhs) const {
if (productId != rhs.productId) {
if (rhs.flags & kConnHashFlagsExactMatch)
break;
if (productId != kNilGuid)
if (productId != kNilUuid)
break;
}
@ -171,7 +171,7 @@ static unsigned GetConnHash (
hash->buildId = 0;
hash->buildType = 0;
hash->branchId = 0;
hash->productId = 0;
hash->productId = kNilUuid;
hash->flags = 0;
// one uint8_t consumed
@ -325,7 +325,7 @@ void AsyncSocketRegisterNotifyProc (
unsigned buildId,
unsigned buildType,
unsigned branchId,
const Uuid & productId
const plUUID& productId
) {
ASSERT(connType != kConnTypeNil);
ASSERT(notifyProc);
@ -354,7 +354,7 @@ void AsyncSocketUnregisterNotifyProc (
unsigned buildId,
unsigned buildType,
unsigned branchId,
const Uuid & productId
const plUUID& productId
) {
ISocketConnHash hash;
hash.connType = connType;
@ -392,7 +392,7 @@ FAsyncNotifySocketProc AsyncSocketFindNotifyProc (
unsigned * buildId,
unsigned * buildType,
unsigned * branchId,
Uuid * productId
plUUID* productId
) {
for (;;) {
// Get the connType

View File

@ -68,7 +68,7 @@ enum EBlueSpiralInitResult {
// Game type id
//============================================================================
const Uuid kGameTypeId_BlueSpiral = Uuid(L"5ff98165-913e-4fd1-a2c2-9c7f31be2cc8");
const plUUID kGameTypeId_BlueSpiral("5ff98165-913e-4fd1-a2c2-9c7f31be2cc8");
//============================================================================

View File

@ -75,7 +75,7 @@ const int kClimbingWallNoBlocker = -1; // the value of a slot in the blocker arr
// Game type id
//============================================================================
const Uuid kGameTypeId_ClimbingWall = Uuid(L"6224cdf4-3556-4740-b7cd-d637562d07be");
const plUUID kGameTypeId_ClimbingWall("6224cdf4-3556-4740-b7cd-d637562d07be");
//============================================================================

View File

@ -91,7 +91,7 @@ enum EHeekCountdownState {
// Game type id
//============================================================================
const Uuid kGameTypeId_Heek = Uuid(L"9d83c2e2-7835-4477-9aaa-22254c59a753");
const plUUID kGameTypeId_Heek("9d83c2e2-7835-4477-9aaa-22254c59a753");
//============================================================================

View File

@ -75,7 +75,7 @@ enum EMarkerGameType {
// Game type id
//============================================================================
const Uuid kGameTypeId_Marker = Uuid(L"000b2c39-0319-4be1-b06c-7a105b160fcf");
const plUUID kGameTypeId_Marker("000b2c39-0319-4be1-b06c-7a105b160fcf");
//============================================================================

View File

@ -54,6 +54,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "pnUtils/pnUtils.h"
#include "pnNetBase/pnNetBase.h"
#include "pnProduct/pnProduct.h"
#include "pnUUID/pnUUID.h"
#include "pnGameMgr.h"
#include "Intern.h"

View File

@ -74,7 +74,7 @@ enum ETTTGameResult {
// Game type id
//============================================================================
const Uuid kGameTypeId_TicTacToe = Uuid(L"a7236529-11d8-4758-9368-59cb43445a83");
const plUUID kGameTypeId_TicTacToe("a7236529-11d8-4758-9368-59cb43445a83");
//============================================================================

View File

@ -68,7 +68,7 @@ enum EVarSyncInitResult {
// Game type id
//============================================================================
const Uuid kGameTypeId_VarSync = Uuid(L"475c2e9b-a245-4106-a047-9b25d41ff333");
const plUUID kGameTypeId_VarSync("475c2e9b-a245-4106-a047-9b25d41ff333");
//============================================================================

View File

@ -181,7 +181,7 @@ enum {
// Cli2Srv
struct Cli2Srv_GameMgr_CreateGame : GameMsgHeader {
Uuid gameTypeId;
plUUID gameTypeId;
uint32_t createOptions;
uint32_t createDataBytes;
uint8_t createData[1]; // [createDataBytes]
@ -190,7 +190,7 @@ enum {
// Field ordering here is vitally important, see pfGameMgr::JoinGame for explanation
uint32_t newGameId;
uint32_t createOptions;
Uuid gameTypeId;
plUUID gameTypeId;
uint32_t createDataBytes;
uint8_t createData[1]; // [createDataBytes]
};
@ -199,17 +199,17 @@ enum {
struct Srv2Cli_GameMgr_GameInstance : GameMsgHeader {
EGameJoinError result;
uint32_t ownerId;
Uuid gameTypeId;
plUUID gameTypeId;
uint32_t newGameId;
};
struct Srv2Cli_GameMgr_InviteReceived : GameMsgHeader {
uint32_t inviterId;
Uuid gameTypeId;
plUUID gameTypeId;
uint32_t newGameId;
};
struct Srv2Cli_GameMgr_InviteRevoked : GameMsgHeader {
uint32_t inviterId;
Uuid gameTypeId;
plUUID gameTypeId;
uint32_t newGameId;
};

View File

@ -49,6 +49,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#pragma hdrstop
#include "pnEncryption/plChallengeHash.h"
#include "pnUUID/pnUUID.h"
//#define NCCLI_DEBUGGING
#ifdef NCCLI_DEBUGGING
@ -112,7 +113,7 @@ enum ENetCliMode {
***/
// connection structure attached to each socket
struct NetCli : THashKeyVal<Uuid> {
struct NetCli {
// communication channel
AsyncSocket sock;
@ -917,7 +918,6 @@ static NetCli * ConnCreate (
cli->protocol = (ENetProtocol) protocol;
cli->channel = channel;
cli->mode = mode;
cli->SetValue(kNilGuid);
#if !defined(PLASMA_EXTERNAL_RELEASE) && defined(HS_BUILD_FOR_WIN32)
// Network debug pipe

View File

@ -105,25 +105,31 @@ uint32_t GetBinAddr(const char * textAddr)
void plCreatableStream::Write( hsStream* stream, hsResMgr* mgr )
{
fStream.Rewind();
std::string buf;
uint32_t len = fStream.GetEOF();
stream->WriteLE( len );
buf.resize( len );
fStream.Read( len, (void*)buf.data() );
stream->Write( len, (const void*)buf.data() );
uint8_t* buf = new uint8_t[len];
fStream.Read(len, (void*)buf);
stream->Write(len, (const void*)buf);
fStream.Rewind();
delete[] buf;
}
void plCreatableStream::Read( hsStream* stream, hsResMgr* mgr )
{
fStream.Rewind();
std::string buf;
uint32_t len;
stream->LogReadLE( &len,"CreatableStream Len");
buf.resize( len );
stream->LogRead( len, (void*)buf.data(),"CreatableStream Data");
fStream.Write( len, (const void*)buf.data() );
uint8_t* buf = new uint8_t[len];
stream->LogRead(len, (void*)buf, "CreatableStream Data");
fStream.Write(len, (const void*)buf);
fStream.Rewind();
delete[] buf;
}
////////////////////////////////////////////////////////////////////

View File

@ -55,6 +55,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "pnNetBase/pnNetBase.h"
#include "pnAsyncCore/pnAsyncCore.h"
#include "pnNetCli/pnNetCli.h"
#include "pnUUID/pnUUID.h"
#ifdef SERVER
#include "psUtils/psUtils.h" // for SrvMsgHeader, ugh

View File

@ -229,7 +229,7 @@ static_assert(kNumAuth2CliMessages <= 0xFFFF, "Auth2Cli message types overflow u
struct Cli2Auth_ConnData {
uint32_t dataBytes;
Uuid token;
plUUID token;
};
struct Cli2Auth_Connect {
AsyncSocketConnectPacket hdr;
@ -286,7 +286,7 @@ struct Cli2Auth_AgeRequest {
uint32_t messageId;
uint32_t transId;
wchar_t ageName[kMaxAgeNameLength];
Uuid ageUuid;
plUUID ageUuid;
};
// AcctCreateRequest
@ -307,7 +307,7 @@ struct Cli2Auth_AcctCreateFromKeyRequest {
uint32_t transId;
wchar_t accountName[kMaxAccountNameLength];
ShaDigest namePassHash;
Uuid key;
plUUID key;
uint32_t billingType;
};
@ -375,7 +375,7 @@ extern const NetMsg kNetMsg_Cli2Auth_AcctActivateRequest;
struct Cli2Auth_AcctActivateRequest {
uint32_t messageId;
uint32_t transId;
Uuid activationKey;
plUUID activationKey;
};
// FileListRequest
@ -435,7 +435,7 @@ struct Cli2Auth_VaultNodeSave {
uint32_t messageId;
uint32_t transId;
uint32_t nodeId;
Uuid revisionId;
plUUID revisionId;
uint32_t nodeBytes;
uint8_t nodeBuffer[1];
};
@ -462,8 +462,8 @@ extern const NetMsg kNetMsg_Cli2Auth_VaultInitAgeRequest;
struct Cli2Auth_VaultInitAgeRequest {
uint32_t messageId;
uint32_t transId;
Uuid ageInstId;
Uuid parentAgeInstId;
plUUID ageInstId;
plUUID parentAgeInstId;
wchar_t ageFilename[MAX_PATH];
wchar_t ageInstName[MAX_PATH];
wchar_t ageUserName[MAX_PATH];
@ -572,7 +572,7 @@ extern const NetMsg kNetMsg_Cli2Auth_SendFriendInviteRequest;
struct Cli2Auth_SendFriendInviteRequest {
uint32_t messageId;
uint32_t transId;
Uuid inviteUuid;
plUUID inviteUuid;
wchar_t emailAddress[kMaxEmailAddressLength];
wchar_t toName[kMaxPlayerNameLength];
};
@ -679,7 +679,7 @@ extern const NetMsg kNetMsg_Auth2Cli_ServerAddr;
struct Auth2Cli_ServerAddr {
uint32_t messageId;
uint32_t srvAddr;
Uuid token;
plUUID token;
};
extern const NetMsg kNetMsg_Auth2Cli_NotifyNewBuild;
@ -704,7 +704,7 @@ struct Auth2Cli_AcctLoginReply {
uint32_t messageId;
uint32_t transId;
ENetError result;
Uuid accountId;
plUUID accountId;
uint32_t accountFlags;
uint32_t billingType;
uint32_t encryptionKey[4];
@ -717,7 +717,7 @@ struct Auth2Cli_AgeReply {
uint32_t transId;
ENetError result;
uint32_t ageMcpId;
Uuid ageInstId;
plUUID ageInstId;
uint32_t ageVaultId;
uint32_t gameSrvNode;
};
@ -728,7 +728,7 @@ struct Auth2Cli_AcctCreateReply {
uint32_t messageId;
uint32_t transId;
ENetError result;
Uuid accountId;
plUUID accountId;
};
// AcctCreateFromKeyReply
@ -737,8 +737,8 @@ struct Auth2Cli_AcctCreateFromKeyReply {
uint32_t messageId;
uint32_t transId;
ENetError result;
Uuid accountId;
Uuid activationKey;
plUUID accountId;
plUUID activationKey;
};
// CreatePlayerReply
@ -870,7 +870,7 @@ extern const NetMsg kNetMsg_Auth2Cli_VaultNodeChanged;
struct Auth2Cli_VaultNodeChanged {
uint32_t messageId;
uint32_t nodeId;
Uuid revisionId;
plUUID revisionId;
};
extern const NetMsg kNetMsg_Auth2Cli_VaultNodeAdded;

View File

@ -97,8 +97,8 @@ static_assert(kNumGame2CliMessages <= 0xFFFF, "Game2Cli message types overflow u
struct Cli2Game_ConnData {
uint32_t dataBytes;
Uuid accountUuid;
Uuid ageUuid;
plUUID accountUuid;
plUUID ageUuid;
};
struct Cli2Game_Connect {
AsyncSocketConnectPacket hdr;
@ -125,7 +125,7 @@ struct Cli2Game_JoinAgeRequest {
uint32_t messageId;
uint32_t transId;
uint32_t ageMcpId;
Uuid accountUuid;
plUUID accountUuid;
uint32_t playerInt;
};

View File

@ -89,7 +89,7 @@ static_assert(kNumGateKeeper2CliMessages <= 0xFFFF, "GateKeeper2Cli message type
struct Cli2GateKeeper_ConnData {
uint32_t dataBytes;
Uuid token;
plUUID token;
};
struct Cli2GateKeeper_Connect {

View File

@ -201,7 +201,7 @@ struct Srv2Db_AccountCreateRequest : SrvMsgHeader {
struct Srv2Db_AccountCreateFromKeyRequest : SrvMsgHeader {
wchar_t accountName[kMaxAccountNameLength];
ShaDigest namePassHash;
Uuid key;
plUUID key;
uint32_t billingType;
};
@ -215,7 +215,7 @@ struct Srv2Db_AccountLoginRequest2 : SrvMsgHeader {
};
struct Srv2Db_AccountLogout : SrvMsgHeader {
Uuid accountUuid;
plUUID accountUuid;
uint32_t timeLoggedMins;
};
@ -235,16 +235,16 @@ struct Srv2Db_AccountSetBillingTypeRequest : SrvMsgHeader {
};
struct Srv2Db_AccountActivateRequest : SrvMsgHeader {
Uuid activationKey;
plUUID activationKey;
};
struct Srv2Db_AccountLockPlayerNameRequest :SrvMsgHeader {
wchar_t playerName[kMaxPlayerNameLength];
Uuid accountUuid;
plUUID accountUuid;
};
struct Srv2Db_VaultNodeCreateRequest : SrvMsgHeader {
Uuid accountUuid;
plUUID accountUuid;
uint32_t creatorId;
uint32_t nodeBytes;
uint8_t nodeBuffer[1];
@ -256,11 +256,11 @@ struct Srv2Db_VaultNodeFetchRequest : SrvMsgHeader {
struct Srv2Db_VaultNodeChanged : SrvMsgHeader {
uint32_t nodeId;
Uuid revisionId;
plUUID revisionId;
};
struct Srv2Db_VaultNodeSaveRequest : SrvMsgHeader {
Uuid revisionId;
plUUID revisionId;
uint32_t nodeId;
unsigned playerCheckId;
unsigned isRequestFromAuth;
@ -321,7 +321,7 @@ struct Srv2Db_SetAgeSequenceNumRequest : SrvMsgHeader {
struct Srv2Db_StateSaveObject : SrvMsgHeader {
uint32_t buildId;
Uuid ownerId;
plUUID ownerId;
wchar_t objectName[kMaxStateObjectName];
uint32_t objectDataBytes;
uint8_t objectData[1];
@ -329,12 +329,12 @@ struct Srv2Db_StateSaveObject : SrvMsgHeader {
};
struct Srv2Db_StateDeleteObject : SrvMsgHeader {
Uuid ownerId;
plUUID ownerId;
wchar_t objectName[kMaxStateObjectName];
};
struct Srv2Db_StateFetchObject : SrvMsgHeader {
Uuid ownerId;
plUUID ownerId;
wchar_t objectName[kMaxStateObjectName];
};
@ -400,11 +400,11 @@ struct Srv2Db_PlayerOffline : SrvMsgHeader {
};
struct Srv2Db_AgeOnline : SrvMsgHeader {
Uuid ageInstId;
plUUID ageInstId;
};
struct Srv2Db_AgeOffline : SrvMsgHeader {
Uuid ageInstId;
plUUID ageInstId;
};
struct Srv2Db_CsrAcctInfoRequest : SrvMsgHeader {
@ -412,7 +412,7 @@ struct Srv2Db_CsrAcctInfoRequest : SrvMsgHeader {
};
struct Srv2Db_FetchInviterInfo : SrvMsgHeader {
Uuid inviteUuid;
plUUID inviteUuid;
};
@ -427,16 +427,16 @@ struct Db2Srv_AccountExistsReply : SrvMsgHeader {
};
struct Db2Srv_AccountCreateReply : SrvMsgHeader {
Uuid accountUuid;
plUUID accountUuid;
};
struct Db2Srv_AccountCreateFromKeyReply : SrvMsgHeader {
Uuid accountUuid;
Uuid activationKey;
plUUID accountUuid;
plUUID activationKey;
};
struct Db2Srv_AccountLoginReply : SrvMsgHeader {
Uuid accountUuid;
plUUID accountUuid;
uint32_t accountFlags;
uint32_t billingType;
ShaDigest namePassHash;
@ -470,12 +470,12 @@ struct Db2Srv_SetAgeSequenceNumReply : SrvMsgHeader {
};
struct Db2Srv_FetchInviterInfoReply : SrvMsgHeader {
Uuid hoodInstance;
plUUID hoodInstance;
};
struct Db2Srv_StateObjectFetched : SrvMsgHeader {
uint32_t buildId;
Uuid ownerId;
plUUID ownerId;
wchar_t objectName[kMaxStateObjectName];
uint32_t objectDataBytes;
uint8_t objectData[1];
@ -484,7 +484,7 @@ struct Db2Srv_StateObjectFetched : SrvMsgHeader {
struct Db2Srv_NotifyVaultNodeChanged : SrvMsgHeader {
uint32_t nodeId;
Uuid revId;
plUUID revId;
uint32_t notifyIdCount;
uint32_t notifyIds[1];
};
@ -545,7 +545,7 @@ struct Db2Srv_ScoreGetRanksReply : SrvMsgHeader {
};
struct Db2Srv_CsrAcctInfoReply : SrvMsgHeader {
Uuid csrId;
plUUID csrId;
uint32_t csrFlags;
ShaDigest namePassHash;
};

View File

@ -125,8 +125,8 @@ struct Srv2Mcp_Connect {
struct Srv2Mcp_AgeJoinRequest : SrvMsgHeader {
wchar_t ageName[kMaxAgeNameLength];
Uuid ageUuid;
Uuid accountUuid;
plUUID ageUuid;
plUUID accountUuid;
uint32_t playerInt;
uint8_t ccrLevel;
wchar_t playerName[kMaxPlayerNameLength];
@ -135,21 +135,21 @@ struct Srv2Mcp_AgeJoinRequest : SrvMsgHeader {
struct Srv2Mcp_PlayerLoggedIn : SrvMsgHeader {
uint32_t ageMcpId;
Uuid ageUuid;
Uuid accountUuid;
plUUID ageUuid;
plUUID accountUuid;
wchar_t playerName[kMaxPlayerNameLength];
uint32_t playerInt;
};
struct Srv2Mcp_PlayerLoggedOut : SrvMsgHeader {
uint32_t ageMcpId;
Uuid accountUuid;
plUUID accountUuid;
uint32_t playerInt;
};
struct Srv2Mcp_AgeSpawned : SrvMsgHeader {
wchar_t ageName[kMaxAgeNameLength];
Uuid ageUuid;
plUUID ageUuid;
uint32_t buildId;
};
@ -159,15 +159,15 @@ struct Srv2Mcp_AgeDied : SrvMsgHeader {
struct Srv2Mcp_AccountLoginRequest : SrvMsgHeader {
wchar_t accountName[kMaxAccountNameLength];
Uuid accountUuid;
plUUID accountUuid;
};
struct Srv2Mcp_AccountLogout : SrvMsgHeader {
Uuid accountUuid;
plUUID accountUuid;
};
struct Srv2Mcp_AccountSetPlayer : SrvMsgHeader {
Uuid accountUuid;
plUUID accountUuid;
uint32_t playerInt;
};
@ -192,14 +192,14 @@ struct Srv2Mcp_KickPlayer : SrvMsgHeader {
struct Mcp2Srv_AgeJoinReply : SrvMsgHeader {
uint32_t ageMcpId;
Uuid ageUuid;
plUUID ageUuid;
uint32_t gameSrvNode;
};
struct Mcp2Srv_AgeSpawnRequest : SrvMsgHeader {
wchar_t ageName[kMaxAgeNameLength];
uint32_t ageMcpId;
Uuid ageUuid;
plUUID ageUuid;
uint32_t buildId;
};
@ -209,15 +209,15 @@ struct Mcp2Srv_AgeUnspawn : SrvMsgHeader {
struct Mcp2Srv_AgeAddPlayerRequest : SrvMsgHeader {
uint32_t ageMcpId;
Uuid accountUuid;
plUUID accountUuid;
uint32_t playerInt;
uint8_t ccrLevel;
wchar_t playerName[kMaxPlayerNameLength];
};
struct Mcp2Srv_AgeRemovePlayerRequest : SrvMsgHeader {
Uuid ageMcpId;
Uuid accountUuid;
plUUID ageMcpId;
plUUID accountUuid;
uint32_t playerInt;
};
@ -230,7 +230,7 @@ struct Mcp2Srv_AccountLoginReply : SrvMsgHeader {
};
struct Mcp2Srv_AccountNotifyKicked : SrvMsgHeader {
Uuid accountUuid;
plUUID accountUuid;
uint32_t acctMcpId;
ENetError reason;
};

View File

@ -95,12 +95,12 @@ struct Srv2State_Connect {
***/
struct Srv2State_FetchObject : SrvMsgHeader {
Uuid ownerId;
plUUID ownerId;
wchar_t objectName[kMaxStateObjectName];
};
struct Srv2State_SaveObject : SrvMsgHeader {
Uuid ownerId;
plUUID ownerId;
wchar_t objectName[kMaxStateObjectName];
uint32_t objectDataBytes;
uint8_t objectData[1]; // objectData[objectDataBytes], actually
@ -108,7 +108,7 @@ struct Srv2State_SaveObject : SrvMsgHeader {
};
struct Srv2State_DeleteObject : SrvMsgHeader {
Uuid ownerId;
plUUID ownerId;
wchar_t objectName[kMaxStateObjectName];
};

View File

@ -169,7 +169,7 @@ struct Srv2Vault_Connect {
***/
struct Srv2Vault_PlayerCreateRequest : SrvMsgHeader {
Uuid accountUuid;
plUUID accountUuid;
wchar_t playerName[kMaxPlayerNameLength];
wchar_t avatarShape[MAX_PATH];
wchar_t friendInvite[MAX_PATH];
@ -177,21 +177,21 @@ struct Srv2Vault_PlayerCreateRequest : SrvMsgHeader {
};
struct Srv2Vault_PlayerDeleteRequest : SrvMsgHeader {
Uuid accountId;
plUUID accountId;
uint32_t playerId;
};
struct Srv2Vault_UpgradeVisitorRequest : SrvMsgHeader {
Uuid accountId;
plUUID accountId;
uint32_t playerId;
};
struct Srv2Vault_AccountLoginRequest : SrvMsgHeader {
Uuid accountUuid;
plUUID accountUuid;
};
struct Srv2Vault_AccountLogout : SrvMsgHeader {
Uuid accountUuid;
plUUID accountUuid;
};
struct Srv2Vault_FetchChildNodeRefs : SrvMsgHeader {
@ -204,7 +204,7 @@ struct Srv2Vault_NodeFetch : SrvMsgHeader {
};
struct Srv2Vault_CreateNodeRequest : SrvMsgHeader {
Uuid accountId;
plUUID accountId;
uint32_t creatorId;
uint32_t nodeBytes;
uint8_t nodeBuffer[1];
@ -220,7 +220,7 @@ struct Srv2Vault_NodeSave : SrvMsgHeader {
uint32_t nodeId;
unsigned playerCheckId;
unsigned isRequestFromAuth;
Uuid revisionId;
plUUID revisionId;
uint32_t nodeBytes;
uint8_t nodeBuffer[1];
};
@ -229,7 +229,7 @@ struct Srv2Vault_NodeSave2 : SrvMsgHeader {
uint32_t nodeId;
unsigned playerCheckId;
unsigned isRequestFromAuth;
Uuid revisionId;
plUUID revisionId;
uint32_t nodeBytes;
uint8_t nodeBuffer[1];
};
@ -270,28 +270,28 @@ struct Srv2Vault_SendNode : SrvMsgHeader {
};
struct Srv2Vault_RegisterPlayerVault : SrvMsgHeader {
Uuid accountId;
plUUID accountId;
uint32_t playerId;
};
struct Srv2Vault_UnregisterPlayerVault : SrvMsgHeader {
Uuid accountId;
plUUID accountId;
};
struct Srv2Vault_RegisterAgeVault : SrvMsgHeader {
Uuid accountId;
plUUID accountId;
uint32_t ageId; // age's vault node id
};
struct Srv2Vault_UnregisterAgeVault : SrvMsgHeader {
Uuid accountId;
plUUID accountId;
};
struct Srv2Vault_AgeInitRequest : SrvMsgHeader {
Uuid accountId;
plUUID accountId;
uint32_t playerId;
Uuid ageInstId;
Uuid parentAgeInstId;
plUUID ageInstId;
plUUID parentAgeInstId;
uint32_t ageLanguage;
uint32_t ageSequenceNumber;
// packed fields:
@ -318,24 +318,24 @@ struct Srv2Vault_CurrentPopulationReply : SrvMsgHeader {
};
struct Srv2Vault_ChangePlayerNameRequest : SrvMsgHeader {
Uuid accountId;
plUUID accountId;
uint32_t playerId;
wchar_t newName[kMaxPlayerNameLength];
};
struct Srv2Vault_AccountOnline : SrvMsgHeader {
Uuid acctId;
plUUID acctId;
uint32_t buildId;
uint32_t authNode;
};
struct Srv2Vault_AccountOffline : SrvMsgHeader {
Uuid acctId;
plUUID acctId;
uint32_t buildId;
};
struct Srv2Vault_PlayerOnline : SrvMsgHeader {
Uuid acctId;
plUUID acctId;
uint32_t buildId;
uint32_t playerId;
};
@ -346,19 +346,19 @@ struct Srv2Vault_PlayerOffline : SrvMsgHeader {
};
struct Srv2Vault_AgeOnline : SrvMsgHeader {
Uuid ageInstId;
plUUID ageInstId;
uint32_t buildId;
uint32_t gameNode;
};
struct Srv2Vault_AgeOffline : SrvMsgHeader {
Uuid ageInstId;
plUUID ageInstId;
uint32_t buildId;
};
struct Srv2Vault_PlayerJoinedAge : SrvMsgHeader {
uint32_t playerId;
Uuid ageInstId;
plUUID ageInstId;
uint32_t buildId;
};
@ -400,24 +400,24 @@ struct Vault2Srv_NodeCreated : SrvMsgHeader {
struct Vault2Srv_NodeChanged : SrvMsgHeader {
uint32_t nodeId;
Uuid revisionId;
Uuid accountId; // the notify target
plUUID revisionId;
plUUID accountId; // the notify target
};
struct Vault2Srv_NodeAdded : SrvMsgHeader {
NetVaultNodeRef ref;
Uuid accountId; // the notify target
plUUID accountId; // the notify target
};
struct Vault2Srv_NodeRemoved : SrvMsgHeader {
uint32_t parentId;
uint32_t childId;
Uuid accountId; // the notify target
plUUID accountId; // the notify target
};
struct Vault2Srv_NodeDeleted : SrvMsgHeader {
uint32_t nodeId;
Uuid accountId; // the notify target
plUUID accountId; // the notify target
};
struct Vault2Srv_NodeFindReply : SrvMsgHeader {
@ -430,7 +430,7 @@ struct Vault2Srv_NodeFindReply : SrvMsgHeader {
struct Vault2Srv_AgeInitReply : SrvMsgHeader {
uint32_t ageNodeId;
uint32_t ageInfoNodeId;
Uuid accountId; // the requestor
plUUID accountId; // the requestor
};
struct Vault2Srv_PublicAgeList : SrvMsgHeader {
@ -441,12 +441,12 @@ struct Vault2Srv_PublicAgeList : SrvMsgHeader {
struct Vault2Srv_NotifyAgeSDLChanged : SrvMsgHeader {
wchar_t ageName[kMaxAgeNameLength];
Uuid ageInstId;
plUUID ageInstId;
};
struct Vault2Srv_CurrentPopulationRequest : SrvMsgHeader {
uint32_t ageCount;
Uuid ageInstIds[1]; // [ageCount], actually
plUUID ageInstIds[1]; // [ageCount], actually
// no more fields after var length alloc
};

View File

@ -42,10 +42,11 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
/*****************************************************************************
*
* $/Plasma20/Sources/Plasma/NucleusLib/pnNetProtocol/Private/pnNpCommon.cpp
*
*
***/
#include "../Pch.h"
#include "pnUUID/pnUUID.h"
#pragma hdrstop
@ -599,8 +600,8 @@ void NetVaultNode::CopyFrom (const NetVaultNode * other, unsigned copyOpts) {
_ZERO(kCreateTime, IVaultNodeSetValue, createTime, (unsigned)0);
_ZERO(kModifyTime, IVaultNodeSetValue, modifyTime, (unsigned)0);
_ZEROSTRING(kCreateAgeName, IVaultNodeSetString, createAgeName, L"");
_ZERO(kCreateAgeUuid, IVaultNodeSetValue, createAgeUuid, kNilGuid);
_ZERO(kCreatorAcct, IVaultNodeSetValue, creatorAcct, kNilGuid);
_ZERO(kCreateAgeUuid, IVaultNodeSetValue, createAgeUuid, kNilUuid);
_ZERO(kCreatorAcct, IVaultNodeSetValue, creatorAcct, kNilUuid);
_ZERO(kCreatorId, IVaultNodeSetValue, creatorId, (unsigned)0);
_ZERO(kNodeType, IVaultNodeSetValue, nodeType, (unsigned)0);
_ZERO(kInt32_1, IVaultNodeSetValue, int32_1, (signed)0);
@ -611,10 +612,10 @@ void NetVaultNode::CopyFrom (const NetVaultNode * other, unsigned copyOpts) {
_ZERO(kUInt32_2, IVaultNodeSetValue, uint32_2, (unsigned)0);
_ZERO(kUInt32_3, IVaultNodeSetValue, uint32_3, (unsigned)0);
_ZERO(kUInt32_4, IVaultNodeSetValue, uint32_4, (unsigned)0);
_ZERO(kUuid_1, IVaultNodeSetValue, uuid_1, kNilGuid);
_ZERO(kUuid_2, IVaultNodeSetValue, uuid_2, kNilGuid);
_ZERO(kUuid_3, IVaultNodeSetValue, uuid_3, kNilGuid);
_ZERO(kUuid_4, IVaultNodeSetValue, uuid_4, kNilGuid);
_ZERO(kUuid_1, IVaultNodeSetValue, uuid_1, kNilUuid);
_ZERO(kUuid_2, IVaultNodeSetValue, uuid_2, kNilUuid);
_ZERO(kUuid_3, IVaultNodeSetValue, uuid_3, kNilUuid);
_ZERO(kUuid_4, IVaultNodeSetValue, uuid_4, kNilUuid);
_ZEROSTRING(kString64_1, IVaultNodeSetString, string64_1, L"");
_ZEROSTRING(kString64_2, IVaultNodeSetString, string64_2, L"");
_ZEROSTRING(kString64_3, IVaultNodeSetString, string64_3, L"");
@ -706,12 +707,12 @@ void NetVaultNode::SetCreateAgeName (const wchar_t v[]) {
}
//============================================================================
void NetVaultNode::SetCreateAgeUuid (const Uuid & v) {
void NetVaultNode::SetCreateAgeUuid (const plUUID& v) {
IVaultNodeSetValue(kCreateAgeUuid, this, &createAgeUuid, v);
}
//============================================================================
void NetVaultNode::SetCreatorAcct (const Uuid & v) {
void NetVaultNode::SetCreatorAcct (const plUUID& v) {
IVaultNodeSetValue(kCreatorAcct, this, &creatorAcct, v);
}
@ -766,22 +767,22 @@ void NetVaultNode::SetUInt32_4 (unsigned v) {
}
//============================================================================
void NetVaultNode::SetUuid_1 (const Uuid & v) {
void NetVaultNode::SetUuid_1 (const plUUID& v) {
IVaultNodeSetValue(kUuid_1, this, &uuid_1, v);
}
//============================================================================
void NetVaultNode::SetUuid_2 (const Uuid & v) {
void NetVaultNode::SetUuid_2 (const plUUID& v) {
IVaultNodeSetValue(kUuid_2, this, &uuid_2, v);
}
//============================================================================
void NetVaultNode::SetUuid_3 (const Uuid & v) {
void NetVaultNode::SetUuid_3 (const plUUID& v) {
IVaultNodeSetValue(kUuid_3, this, &uuid_3, v);
}
//============================================================================
void NetVaultNode::SetUuid_4 (const Uuid & v) {
void NetVaultNode::SetUuid_4 (const plUUID& v) {
IVaultNodeSetValue(kUuid_4, this, &uuid_4, v);
}
@ -976,7 +977,7 @@ void NetVaultNodeFieldArray::GetFieldValueString_LCS (
case NetVaultNode::kUuid_2:
case NetVaultNode::kUuid_3:
case NetVaultNode::kUuid_4: {
plString tmp = plUUID(fieldAddr).AsString();
plString tmp = plUUID((char*)fieldAddr).AsString();
StrPrintf(dst, dstChars, L"hextoraw('%s')", tmp.c_str());
}

View File

@ -50,6 +50,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#endif
#define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETPROTOCOL_PRIVATE_PNNPCOMMON_H
#include "pnUUID/pnUUID.h"
/*****************************************************************************
*
@ -62,7 +64,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
const NetMsgField kNetMsgFieldAccountName = NET_MSG_FIELD_STRING(kMaxAccountNameLength);
const NetMsgField kNetMsgFieldPlayerName = NET_MSG_FIELD_STRING(kMaxPlayerNameLength);
const NetMsgField kNetMsgFieldShaDigest = NET_MSG_FIELD_RAW_DATA(sizeof(ShaDigest));
const NetMsgField kNetMsgFieldUuid = NET_MSG_FIELD_DATA(sizeof(Uuid));
const NetMsgField kNetMsgFieldUuid = NET_MSG_FIELD_DATA(sizeof(plUUID));
const NetMsgField kNetMsgFieldTransId = NET_MSG_FIELD_DWORD();
const NetMsgField kNetMsgFieldTimeMs = NET_MSG_FIELD_DWORD();
const NetMsgField kNetMsgFieldENetError = NET_MSG_FIELD_DWORD();
@ -96,7 +98,7 @@ struct SrvPlayerInfo {
***/
struct NetAgeInfo {
Uuid ageInstId;
plUUID ageInstId;
wchar_t ageFilename[kMaxAgeNameLength];
wchar_t ageInstName[kMaxAgeNameLength];
wchar_t ageUserName[kMaxAgeNameLength];
@ -209,7 +211,7 @@ struct NetVaultNode : AtomicRef {
uint64_t fieldFlags;
uint64_t dirtyFlags;
Uuid revisionId;
plUUID revisionId;
// Treat these as read-only or node flag fields will become invalid
// Threaded apps: Must be accessed with node->critsect locked
@ -217,8 +219,8 @@ struct NetVaultNode : AtomicRef {
unsigned createTime;
unsigned modifyTime;
wchar_t * createAgeName;
Uuid createAgeUuid;
Uuid creatorAcct; // accountId of node creator
plUUID createAgeUuid;
plUUID creatorAcct; // accountId of node creator
unsigned creatorId; // playerId of node creator
unsigned nodeType;
int int32_1;
@ -229,10 +231,10 @@ struct NetVaultNode : AtomicRef {
unsigned uint32_2;
unsigned uint32_3;
unsigned uint32_4;
Uuid uuid_1;
Uuid uuid_2;
Uuid uuid_3;
Uuid uuid_4;
plUUID uuid_1;
plUUID uuid_2;
plUUID uuid_3;
plUUID uuid_4;
wchar_t * string64_1;
wchar_t * string64_2;
wchar_t * string64_3;
@ -261,8 +263,8 @@ struct NetVaultNode : AtomicRef {
void SetCreateTime (unsigned v);
void SetModifyTime (unsigned v);
void SetCreateAgeName (const wchar_t v[]);
void SetCreateAgeUuid (const Uuid & v);
void SetCreatorAcct (const Uuid & v);
void SetCreateAgeUuid (const plUUID& v);
void SetCreatorAcct (const plUUID& v);
void SetCreatorId (unsigned v);
void SetNodeType (unsigned v);
void SetInt32_1 (int v);
@ -273,10 +275,10 @@ struct NetVaultNode : AtomicRef {
void SetUInt32_2 (unsigned v);
void SetUInt32_3 (unsigned v);
void SetUInt32_4 (unsigned v);
void SetUuid_1 (const Uuid & v);
void SetUuid_2 (const Uuid & v);
void SetUuid_3 (const Uuid & v);
void SetUuid_4 (const Uuid & v);
void SetUuid_1 (const plUUID& v);
void SetUuid_2 (const plUUID& v);
void SetUuid_3 (const plUUID& v);
void SetUuid_4 (const plUUID& v);
void SetString64_1 (const wchar_t v[]);
void SetString64_2 (const wchar_t v[]);
void SetString64_3 (const wchar_t v[]);
@ -298,8 +300,8 @@ struct NetVaultNode : AtomicRef {
inline unsigned GetCreateTime () const { return createTime; }
inline unsigned GetModifyTime () const { return modifyTime; }
inline wchar_t * GetCreateAgeName () const { return createAgeName; }
inline Uuid GetCreateAgeUuid () const { return createAgeUuid; }
inline Uuid GetCreatorAcct () const { return creatorAcct; }
inline plUUID GetCreateAgeUuid () const { return createAgeUuid; }
inline plUUID GetCreatorAcct () const { return creatorAcct; }
inline unsigned GetCreatorId () const { return creatorId; }
inline unsigned GetNodeType () const { return nodeType; }
inline int GetInt32_1 () const { return int32_1; }
@ -310,10 +312,10 @@ struct NetVaultNode : AtomicRef {
inline unsigned GetUInt32_2 () const { return uint32_2; }
inline unsigned GetUInt32_3 () const { return uint32_3; }
inline unsigned GetUInt32_4 () const { return uint32_4; }
inline Uuid GetUuid_1 () const { return uuid_1; }
inline Uuid GetUuid_2 () const { return uuid_2; }
inline Uuid GetUuid_3 () const { return uuid_3; }
inline Uuid GetUuid_4 () const { return uuid_4; }
inline plUUID GetUuid_1 () const { return uuid_1; }
inline plUUID GetUuid_2 () const { return uuid_2; }
inline plUUID GetUuid_3 () const { return uuid_3; }
inline plUUID GetUuid_4 () const { return uuid_4; }
inline wchar_t * GetString64_1 () const { return string64_1; }
inline wchar_t * GetString64_2 () const { return string64_2; }
inline wchar_t * GetString64_3 () const { return string64_3; }

View File

@ -42,6 +42,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "pnUUID.h"
#include "hsStream.h"
const plUUID kNilUuid;
plUUID::plUUID()
{
Clear();
@ -57,11 +59,6 @@ plUUID::plUUID(const plUUID& other)
CopyFrom(&other);
}
plUUID::plUUID(const Uuid& uuid)
{
memcpy(fData, uuid.data, sizeof(fData));
}
void plUUID::Read(hsStream* s)
{
s->LogSubStreamPushDesc("plUUID");
@ -79,10 +76,3 @@ plString plUUID::AsString() const
ToString(str);
return str;
}
plUUID::operator Uuid () const
{
Uuid uuid;
memcpy(uuid.data, fData, sizeof(uuid.data));
return uuid;
}

View File

@ -43,10 +43,11 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#define pnUUID_h_inc
#include "HeadSpin.h"
#include "pnUtils/pnUtUuid.h"
#include "plString.h"
class hsStream;
class plString;
extern const class plUUID kNilUuid;
class plUUID
{
@ -63,7 +64,6 @@ public:
plUUID();
plUUID(const plString& s);
plUUID(const plUUID& other);
plUUID(const Uuid& uuid);
void Clear();
bool IsNull() const;
@ -92,7 +92,6 @@ public:
return CompareTo(&other) == -1;
}
operator plString (void) const { return AsString(); }
operator Uuid () const;
static plUUID Generate();
};

View File

@ -64,7 +64,7 @@ struct plUUIDHelper
void plUUID::Clear()
{
uuid_t g;
plUUIDHelper::CopyToNative( g, this );
//plUUIDHelper::CopyToNative( g, this );
uuid_clear( g );
plUUIDHelper::CopyToPlasma( this, g );
}
@ -98,11 +98,16 @@ bool plUUID::IsEqualTo( const plUUID * v ) const
bool plUUID::FromString( const char * str )
{
Clear();
if ( !str )
if (!str) {
return false;
}
uuid_t g;
uuid_parse( str, g );
plUUIDHelper::CopyToPlasma( this, g );
if (uuid_parse(str, g) != 0) {
return false;
}
plUUIDHelper::CopyToPlasma(this, g);
return true;
}

View File

@ -19,7 +19,6 @@ set(pnUtils_HEADERS
pnUtSort.h
pnUtStr.h
pnUtTime.h
pnUtUuid.h
)
set(pnUtils_SOURCES
@ -32,7 +31,6 @@ set(pnUtils_SOURCES
pnUtPath.cpp
pnUtStr.cpp
pnUtTime.cpp
pnUtUuid.cpp
)
if(WIN32)
@ -40,12 +38,10 @@ if(WIN32)
Win32/pnUtW32Misc.cpp
Win32/pnUtW32Path.cpp
Win32/pnUtW32Str.cpp
Win32/pnUtW32Uuid.cpp
)
else()
set(pnUtils_UNIX
Unix/pnUtUxStr.cpp
Unix/pnUtUxUuid.cpp
)
endif()

View File

@ -1,69 +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/Unix/pnUtUxUuid.cpp
*
***/
#include "../pnUtUuid.h"
/*****************************************************************************
*
* Uuid Unix implementation
*
***/
#ifdef HS_BUILD_FOR_UNIX
#include <uuid/uuid.h>
static_assert(sizeof(Uuid) >= sizeof(uuid_t), "UUID size does not match uuid_t");
#else
// Dummy function to prevent a linker warning complaining about no public symbols if the
// contents of the file get compiled out via pre-processor
void UxUuidPreventLNK4221Warning () {
}
#endif

View File

@ -1,150 +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/Win32/pnUtW32Uuid.cpp
*
***/
#include "../pnUtils.h"
#include <rpc.h>
#include <rpcdce.h>
#if 0
void Uuid::Clear()
{
UuidCreateNil( (GUID *)this );
}
int Uuid::CompareTo( const Uuid * v ) const
{
RPC_STATUS s;
return UuidCompare( (GUID *)this, (GUID *)v, &s );
}
bool Uuid::IsEqualTo( const Uuid * v ) const
{
return ( CompareTo( v )==0 );
}
void Uuid::CopyFrom( const Uuid * v )
{
memcpy( (void*)fData, (const void*)v->fData, sizeof(fData) );
}
bool Uuid::IsNull() const
{
RPC_STATUS s;
return 1 == UuidIsNil( (GUID *)this, &s );
}
bool Uuid::FromString( const char * str )
{
Clear();
if ( !str )
return false;
return RPC_S_OK == UuidFromString( (unsigned char *)str, (GUID *)this );
}
bool Uuid::ToString( std::string & out ) const
{
out = "";
unsigned char * ubuf;
RPC_STATUS s;
s = UuidToString( (GUID *) this, &ubuf );
bool success = ( s==RPC_S_OK );
if ( success )
out = (char*)ubuf;
RpcStringFree( &ubuf );
return success;
}
// static
Uuid Uuid::Generate()
{
Uuid result;
UuidCreate( (GUID *)&result );
return result;
}
#endif
#ifdef HS_BUILD_FOR_WIN32
/*****************************************************************************
*
* Exports
*
***/
static_assert(sizeof(Uuid) >= sizeof(GUID), "pnUtils Uuid and Win32 GUID types differ in size");
//============================================================================
bool GuidFromString (const wchar_t str[], Uuid * uuid) {
ASSERT(uuid);
static_assert(sizeof(wchar_t) == sizeof(unsigned short), "Wchar is not an uint16");
return RPC_S_OK == UuidFromStringW((unsigned short *) str, (GUID *) uuid);
}
//============================================================================
bool GuidFromString (const char str[], Uuid * uuid) {
ASSERT(uuid);
return RPC_S_OK == UuidFromStringA((unsigned char *) str, (GUID *) uuid);
}
//============================================================================
int GuidCompare (const Uuid & a, const Uuid & b) {
RPC_STATUS s;
return UuidCompare((GUID *)&a, (GUID *)&b, &s);
}
//============================================================================
bool GuidIsNil (const Uuid & uuid) {
RPC_STATUS s;
return 1 == UuidIsNil((GUID *)&uuid, &s );
}
#endif // HS_BUILD_FOR_WIN32

View File

@ -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 "pnUtUuid.h"
#include "pnUtSort.h"
#include "pnUtArray.h"
#include "pnUtList.h"

View File

@ -1,66 +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/pnUtUuid.cpp
*
***/
#include "pnUtUuid.h"
#include "pnUtHash.h"
#include "pnUtStr.h"
const Uuid kNilGuid;
/*****************************************************************************
*
* Exports
*
***/
//============================================================================
Uuid::Uuid (const wchar_t str[]) {
GuidFromString(str, this);
}

View File

@ -1,110 +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/pnUtUuid.h
*
***/
#ifndef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTUUID_H
#define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTUUID_H
#include "Pch.h"
/*****************************************************************************
*
* Types
*
***/
struct Uuid;
/*****************************************************************************
*
* Constants
*
***/
extern const Uuid kNilGuid;
/*****************************************************************************
*
* Functions
*
***/
// Using 'Guid' here instead of 'Uuid' to avoid name clash with windows API =(
bool GuidFromString (const wchar_t str[], Uuid * uuid);
bool GuidFromString (const char str[], Uuid * uuid);
int GuidCompare (const Uuid & a, const Uuid & b);
inline bool GuidsAreEqual (const Uuid & a, const Uuid & b) { return 0 == GuidCompare(a, b); }
bool GuidIsNil (const Uuid & uuid);
/*****************************************************************************
*
* Uuid
*
***/
#pragma pack(push, 1)
struct Uuid {
union {
uint32_t uint32_ts[4];
uint8_t data[16];
};
Uuid () {}
Uuid (const wchar_t str[]);
operator bool () const { return !GuidIsNil(*this); }
inline bool operator ! () const { return GuidIsNil(*this); }
inline bool operator < (const Uuid & rhs) const { return GuidCompare(*this, rhs) < 0; }
inline bool operator == (const Uuid & rhs) const { return GuidsAreEqual(*this, rhs); }
inline bool operator == (int rhs) const { ASSERT(!rhs); return GuidsAreEqual(*this, kNilGuid); }
inline bool operator != (const Uuid & rhs) const { return !GuidsAreEqual(*this, rhs); }
inline bool operator != (int rhs) const { ASSERT(!rhs); return !GuidsAreEqual(*this, kNilGuid); }
};
#pragma pack(pop)
#endif