Browse Source

Add proper member access control to NetVaultNode

Michael Hansen 12 years ago
parent
commit
ca916fee49
  1. 8
      Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp
  2. 2
      Sources/Plasma/FeatureLib/pfPython/pyAgeVault.cpp
  3. 4
      Sources/Plasma/FeatureLib/pfPython/pyDniInfoSource.cpp
  4. 8
      Sources/Plasma/FeatureLib/pfPython/pyGameScore.cpp
  5. 28
      Sources/Plasma/FeatureLib/pfPython/pyVault.cpp
  6. 26
      Sources/Plasma/FeatureLib/pfPython/pyVaultAgeInfoNode.cpp
  7. 4
      Sources/Plasma/FeatureLib/pfPython/pyVaultAgeLinkNode.cpp
  8. 8
      Sources/Plasma/FeatureLib/pfPython/pyVaultChronicleNode.cpp
  9. 10
      Sources/Plasma/FeatureLib/pfPython/pyVaultFolderNode.cpp
  10. 12
      Sources/Plasma/FeatureLib/pfPython/pyVaultImageNode.cpp
  11. 4
      Sources/Plasma/FeatureLib/pfPython/pyVaultMarkerGameNode.cpp
  12. 80
      Sources/Plasma/FeatureLib/pfPython/pyVaultNode.cpp
  13. 20
      Sources/Plasma/FeatureLib/pfPython/pyVaultNodeRef.cpp
  14. 6
      Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoListNode.cpp
  15. 18
      Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoNode.cpp
  16. 14
      Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerNode.cpp
  17. 4
      Sources/Plasma/FeatureLib/pfPython/pyVaultSDLNode.cpp
  18. 24
      Sources/Plasma/FeatureLib/pfPython/pyVaultTextNoteNode.cpp
  19. 546
      Sources/Plasma/NucleusLib/pnNetProtocol/Private/pnNpCommon.cpp
  20. 351
      Sources/Plasma/NucleusLib/pnNetProtocol/Private/pnNpCommon.h
  21. 34
      Sources/Plasma/PubUtilLib/plAvatar/plAvatarClothing.cpp
  22. 2
      Sources/Plasma/PubUtilLib/plInputCore/plSceneInputInterface.cpp
  23. 14
      Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp
  24. 12
      Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAuth.cpp
  25. 413
      Sources/Plasma/PubUtilLib/plVault/plVaultClientApi.cpp
  26. 530
      Sources/Plasma/PubUtilLib/plVault/plVaultNodeAccess.cpp
  27. 345
      Sources/Plasma/PubUtilLib/plVault/plVaultNodeAccess.h

8
Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp

@ -2436,15 +2436,15 @@ void cyMisc::RemovePublicAge( const char * ageInstanceGuid, PyObject * cbObject/
int cyMisc::GetKILevel()
{
int result = pfKIMsg::kNanoKI;
wchar_t wStr[MAX_PATH];
StrToUnicode(wStr, pfKIMsg::kChronicleKILevel, arrsize(wStr));
if (RelVaultNode * rvn = VaultFindChronicleEntryIncRef(wStr)) {
VaultChronicleNode chron(rvn);
result = wcstol(chron.entryValue, nil, 0);
result = wcstol(chron.GetEntryValue(), nil, 0);
rvn->DecRef();
}
return result;
}
@ -2828,7 +2828,7 @@ void cyMisc::SendFriendInvite(const wchar_t email[], const wchar_t toName[])
if (RelVaultNode* pNode = VaultGetPlayerNodeIncRef())
{
VaultPlayerNode player(pNode);
plUUID inviteUuid(player.inviteUuid);
plUUID inviteUuid = player.GetInviteUuid();
// If we don't have an invite UUID set then make a new one
if (inviteUuid.IsNull())

2
Sources/Plasma/FeatureLib/pfPython/pyAgeVault.cpp

@ -189,7 +189,7 @@ plUUID pyAgeVault::GetAgeGuid( void )
RelVaultNode * rvn = VaultGetAgeInfoNodeIncRef();
if (rvn) {
VaultAgeInfoNode ageInfo(rvn);
plUUID uuid = plUUID(ageInfo.ageInstUuid);
plUUID uuid = ageInfo.GetAgeInstanceGuid();
rvn->DecRef();
return uuid;
}

4
Sources/Plasma/FeatureLib/pfPython/pyDniInfoSource.cpp

@ -94,7 +94,7 @@ const char * pyDniInfoSource::GetAgeName( void ) const
VaultAgeInfoNode ageInfo(node);
fAgeName = StrDupToAnsi(ageInfo.ageInstName);
fAgeName = StrDupToAnsi(ageInfo.GetAgeInstanceName());
node->DecRef();
return fAgeName;
@ -105,7 +105,7 @@ plUUID pyDniInfoSource::GetAgeGuid( void ) const
if (RelVaultNode * node = VaultGetAgeInfoNodeIncRef())
{
VaultAgeInfoNode ageInfo(node);
plUUID uuid = plUUID(ageInfo.ageInstUuid);
plUUID uuid = ageInfo.GetAgeInstanceGuid();
node->DecRef();
return uuid;

8
Sources/Plasma/FeatureLib/pfPython/pyGameScore.cpp

@ -127,7 +127,7 @@ void pyGameScore::CreateAgeScore(const plString& name, uint32_t type, int32_t po
{
if (RelVaultNode* ageInfo = VaultGetAgeInfoNodeIncRef())
{
uint32_t ownerId = ageInfo->nodeId;
uint32_t ownerId = ageInfo->GetNodeId();
pfGameScore::Create(ownerId, name, type, points, rcvr.getKey());
ageInfo->DecRef();
} else
@ -143,7 +143,7 @@ void pyGameScore::CreatePlayerScore(const plString& name, uint32_t type, int32_t
{
if (RelVaultNode* node = VaultGetPlayerInfoNodeIncRef())
{
uint32_t ownerId = node->nodeId;
uint32_t ownerId = node->GetNodeId();
pfGameScore::Create(ownerId, name, type, points, rcvr.getKey());
node->DecRef();
} else
@ -159,7 +159,7 @@ void pyGameScore::FindAgeScores(const plString& name, pyKey& rcvr)
{
if (RelVaultNode* ageInfo = VaultGetAgeInfoNodeIncRef())
{
uint32_t ownerId = ageInfo->nodeId;
uint32_t ownerId = ageInfo->GetNodeId();
pfGameScore::Find(ownerId, name, rcvr.getKey());
ageInfo->DecRef();
} else
@ -175,7 +175,7 @@ void pyGameScore::FindPlayerScores(const plString& name, pyKey& rcvr)
{
if (RelVaultNode* node = VaultGetPlayerInfoNodeIncRef())
{
uint32_t ownerId = node->nodeId;
uint32_t ownerId = node->GetNodeId();
pfGameScore::Find(ownerId, name, rcvr.getKey());
node->DecRef();
}

28
Sources/Plasma/FeatureLib/pfPython/pyVault.cpp

@ -225,11 +225,11 @@ PyObject* pyVault::GetKIUsage(void)
RelVaultNode ** end = nodeArr.Term();
for (; cur != end; ++cur) {
RelVaultNode * rvn = *cur;
if (rvn->nodeType == plVault::kNodeType_Image)
if (rvn->GetNodeType() == plVault::kNodeType_Image)
++pictures;
else if (rvn->nodeType == plVault::kNodeType_TextNote)
else if (rvn->GetNodeType() == plVault::kNodeType_TextNote)
++notes;
else if (rvn->nodeType == plVault::kNodeType_MarkerGame)
else if (rvn->GetNodeType() == plVault::kNodeType_MarkerGame)
++markerGames;
rvn->DecRef();
}
@ -385,7 +385,7 @@ void pyVault::SendToDevice( pyVaultNode& node, const char * deviceName )
StrToUnicode(wDevName, deviceName, arrsize(wDevName));
// Note: This actually blocks (~Hoikas)
VaultPublishNode(node.GetNode()->nodeId, wDevName);
VaultPublishNode(node.GetNode()->GetNodeId(), wDevName);
}
@ -433,10 +433,10 @@ PyObject* pyVault::GetPsnlAgeSDL() const
PyObject * result = nil;
NetVaultNode * templateNode = new NetVaultNode;
templateNode->IncRef();
if (RelVaultNode * rvnFldr = VaultGetAgesIOwnFolderIncRef()) {
templateNode->fieldFlags = 0;
templateNode->ClearFieldFlags();
templateNode->SetNodeType(plVault::kNodeType_AgeInfo);
VaultAgeInfoNode ageInfo(templateNode);
wchar_t str[MAX_PATH];
@ -444,8 +444,8 @@ PyObject* pyVault::GetPsnlAgeSDL() const
ageInfo.SetAgeFilename(str);
if (RelVaultNode * rvnInfo = rvnFldr->GetChildNodeIncRef(templateNode, 2)) {
templateNode->fieldFlags = 0;
templateNode->ClearFieldFlags();
templateNode->SetNodeType(plVault::kNodeType_SDL);
if (RelVaultNode * rvnSdl = rvnInfo->GetChildNodeIncRef(templateNode, 1)) {
@ -478,10 +478,10 @@ void pyVault::UpdatePsnlAgeSDL( pySDLStateDataRecord & pyrec )
NetVaultNode * templateNode = new NetVaultNode;
templateNode->IncRef();
if (RelVaultNode * rvnFldr = VaultGetAgesIOwnFolderIncRef()) {
templateNode->fieldFlags = 0;
templateNode->ClearFieldFlags();
templateNode->SetNodeType(plVault::kNodeType_AgeInfo);
VaultAgeInfoNode ageInfo(templateNode);
wchar_t str[MAX_PATH];
@ -489,8 +489,8 @@ void pyVault::UpdatePsnlAgeSDL( pySDLStateDataRecord & pyrec )
ageInfo.SetAgeFilename(str);
if (RelVaultNode * rvnInfo = rvnFldr->GetChildNodeIncRef(templateNode, 2)) {
templateNode->fieldFlags = 0;
templateNode->ClearFieldFlags();
templateNode->SetNodeType(plVault::kNodeType_SDL);
if (RelVaultNode * rvnSdl = rvnInfo->GetChildNodeIncRef(templateNode, 1)) {

26
Sources/Plasma/FeatureLib/pfPython/pyVaultAgeInfoNode.cpp

@ -189,7 +189,7 @@ const char * pyVaultAgeInfoNode::GetAgeFilename() const
if (fNode) {
char str[MAX_PATH];
VaultAgeInfoNode access(fNode);
StrToAnsi(str, access.ageFilename, arrsize(str));
StrToAnsi(str, access.GetAgeFilename(), arrsize(str));
fAgeFilename = str;
}
return fAgeFilename.c_str();
@ -204,7 +204,7 @@ const char * pyVaultAgeInfoNode::GetAgeInstanceName() const
if (fNode) {
char str[MAX_PATH];
VaultAgeInfoNode access(fNode);
StrToAnsi(str, access.ageInstName, arrsize(str));
StrToAnsi(str, access.GetAgeInstanceName(), arrsize(str));
fAgeInstName = str;
}
return fAgeInstName.c_str();
@ -219,7 +219,7 @@ const char * pyVaultAgeInfoNode::GetAgeUserDefinedName() const
if (fNode) {
char str[MAX_PATH];
VaultAgeInfoNode access(fNode);
StrToAnsi(str, access.ageUserDefinedName, arrsize(str));
StrToAnsi(str, access.GetAgeUserDefinedName(), arrsize(str));
fAgeUserName = str;
}
return fAgeUserName.c_str();
@ -234,7 +234,7 @@ plUUID pyVaultAgeInfoNode::GetAgeInstanceGuid() const
if (fNode) {
VaultAgeInfoNode access(fNode);
return plUUID(access.ageInstUuid);
return access.GetAgeInstanceGuid();
}
return kNilUuid;
}
@ -249,7 +249,7 @@ const char * pyVaultAgeInfoNode::GetAgeDescription() const
char str[MAX_PATH];
memset(str, 0, sizeof(str));
VaultAgeInfoNode access(fNode);
StrToAnsi(str, access.ageDescription, arrsize(str));
StrToAnsi(str, access.GetAgeDescription(), arrsize(str));
fAgeDescription = str;
}
return fAgeDescription.c_str();
@ -263,9 +263,9 @@ int32_t pyVaultAgeInfoNode::GetSequenceNumber() const
{
if (!fNode)
return -1;
VaultAgeInfoNode access(fNode);
return access.ageSequenceNumber;
return access.GetAgeSequenceNumber();
}
void pyVaultAgeInfoNode::SetSequenceNumber( int32_t v )
@ -276,9 +276,9 @@ int32_t pyVaultAgeInfoNode::GetAgeLanguage() const
{
if (!fNode)
return -1;
VaultAgeInfoNode access(fNode);
return access.ageLanguage;
return access.GetAgeLanguage();
}
void pyVaultAgeInfoNode::SetAgeLanguage( int32_t v )
@ -305,7 +305,7 @@ bool pyVaultAgeInfoNode::IsPublic() const
{
if (fNode) {
VaultAgeInfoNode access(fNode);
return access.ageIsPublic;
return access.GetIsPublic();
}
return false;
}
@ -315,10 +315,10 @@ const char * pyVaultAgeInfoNode::GetDisplayName() const
if (fNode) {
char str[MAX_PATH];
VaultAgeInfoNode access(fNode);
if (access.ageSequenceNumber > 0)
StrPrintf(str, arrsize(str), "%S(%d) %S", access.ageUserDefinedName, access.ageSequenceNumber, access.ageInstName);
if (access.GetAgeSequenceNumber() > 0)
StrPrintf(str, arrsize(str), "%S(%d) %S", access.GetAgeUserDefinedName(), access.GetAgeSequenceNumber(), access.GetAgeInstanceName());
else
StrPrintf(str, arrsize(str), "%S %S", access.ageUserDefinedName, access.ageInstName);
StrPrintf(str, arrsize(str), "%S %S", access.GetAgeUserDefinedName(), access.GetAgeInstanceName());
fAgeDispName = str;
}
return fAgeDispName.c_str();

4
Sources/Plasma/FeatureLib/pfPython/pyVaultAgeLinkNode.cpp

@ -109,7 +109,7 @@ bool pyVaultAgeLinkNode::GetLocked() const
return false;
VaultAgeLinkNode access(fNode);
return !access.unlocked;
return !access.GetUnlocked();
}
void pyVaultAgeLinkNode::SetVolatile( bool v )
@ -127,7 +127,7 @@ bool pyVaultAgeLinkNode::GetVolatile() const
return false;
VaultAgeLinkNode access(fNode);
return access.volat;
return access.GetVolatile();
}
void pyVaultAgeLinkNode::AddSpawnPoint( pySpawnPointInfo & point )

8
Sources/Plasma/FeatureLib/pfPython/pyVaultChronicleNode.cpp

@ -97,7 +97,7 @@ const char * pyVaultChronicleNode::Chronicle_GetName( void )
free(ansiName);
VaultChronicleNode chron(fNode);
ansiName = StrDupToAnsi(chron.entryName);
ansiName = StrDupToAnsi(chron.GetEntryName());
return ansiName;
}
@ -123,10 +123,10 @@ const char * pyVaultChronicleNode::Chronicle_GetValue( void )
VaultChronicleNode chron(fNode);
if (!chron.entryValue)
if (!chron.GetEntryValue())
return "";
ansiValue = StrDupToAnsi(chron.entryValue);
ansiValue = StrDupToAnsi(chron.GetEntryValue());
return ansiValue;
}
@ -145,5 +145,5 @@ uint32_t pyVaultChronicleNode::Chronicle_GetType( void )
return 0;
VaultChronicleNode chron(fNode);
return chron.entryType;
return chron.GetEntryType();
}

10
Sources/Plasma/FeatureLib/pfPython/pyVaultFolderNode.cpp

@ -84,7 +84,7 @@ int pyVaultFolderNode::Folder_GetType( void )
return 0;
VaultFolderNode folder(fNode);
return folder.folderType;
return folder.GetFolderType();
}
void pyVaultFolderNode::Folder_SetName( std::string name )
@ -113,11 +113,11 @@ std::string pyVaultFolderNode::Folder_GetName( void )
return "";
VaultFolderNode folder(fNode);
if (!folder.folderName)
if (!folder.GetFolderName())
return "";
std::string retVal;
char* sName = hsWStringToString(folder.folderName);
char* sName = hsWStringToString(folder.GetFolderName());
retVal = sName;
delete [] sName;
return retVal;
@ -129,8 +129,8 @@ std::wstring pyVaultFolderNode::Folder_GetNameW( void )
return L"";
VaultFolderNode folder(fNode);
if (!folder.folderName)
if (!folder.GetFolderName())
return L"";
return folder.folderName;
return folder.GetFolderName();
}

12
Sources/Plasma/FeatureLib/pfPython/pyVaultImageNode.cpp

@ -141,9 +141,9 @@ std::string pyVaultImageNode::Image_GetTitle( void )
VaultImageNode image(fNode);
std::string retVal = "";
if (image.title)
if (image.GetImageTitle())
{
char* temp = hsWStringToString(image.title);
char* temp = hsWStringToString(image.GetImageTitle());
retVal = temp;
delete [] temp;
}
@ -157,7 +157,7 @@ std::wstring pyVaultImageNode::Image_GetTitleW( void )
return L"";
VaultImageNode image(fNode);
return image.title ? image.title : L"";
return image.GetImageTitle() ? image.GetImageTitle() : L"";
}
PyObject* pyVaultImageNode::Image_GetImage( void )
@ -170,7 +170,7 @@ PyObject* pyVaultImageNode::Image_GetImage( void )
if (access.ExtractImage(&fMipmap)) {
fMipmapKey = fMipmap->GetKey();
if (!fMipmapKey)
fMipmapKey = CreateAndRefImageKey(fNode->nodeId, fMipmap);
fMipmapKey = CreateAndRefImageKey(fNode->GetNodeId(), fMipmap);
else
fMipmapKey->RefObject();
}
@ -199,7 +199,7 @@ void pyVaultImageNode::Image_SetImage(pyImage& image)
fMipmapKey = image.GetKey();
if (!fMipmapKey)
fMipmapKey = CreateAndRefImageKey(fNode->nodeId, fMipmap);
fMipmapKey = CreateAndRefImageKey(fNode->GetNodeId(), fMipmap);
else
fMipmapKey->RefObject();
}
@ -243,7 +243,7 @@ void pyVaultImageNode::SetImageFromScrShot()
if (cyMisc::GetPipeline()->CaptureScreen(fMipmap, false, 800, 600)) {
fMipmapKey = fMipmap->GetKey();
if (!fMipmapKey)
fMipmapKey = CreateAndRefImageKey(fNode->nodeId, fMipmap);
fMipmapKey = CreateAndRefImageKey(fNode->GetNodeId(), fMipmap);
else
fMipmapKey->RefObject();
access.StuffImage(fMipmap);

4
Sources/Plasma/FeatureLib/pfPython/pyVaultMarkerGameNode.cpp

@ -74,7 +74,7 @@ const char * pyVaultMarkerGameNode::GetGameName () const
if (fNode) {
VaultMarkerGameNode access(fNode);
StrToAnsi(fGameName, access.gameName, arrsize(fGameName));
StrToAnsi(fGameName, access.GetGameName(), arrsize(fGameName));
}
return fGameName;
}
@ -93,7 +93,7 @@ plUUID pyVaultMarkerGameNode::GetGameGuid() const
{
if (fNode) {
VaultMarkerGameNode access(fNode);
return access.gameGuid;
return access.GetGameGuid();
}
return kNilUuid;
}

80
Sources/Plasma/FeatureLib/pfPython/pyVaultNode.cpp

@ -208,7 +208,7 @@ bool pyVaultNode::operator==(const pyVaultNode &vaultNode) const
return true;
if (ours == nil || theirs == nil)
return false;
if (ours->nodeId == theirs->nodeId)
if (ours->GetNodeId() == theirs->GetNodeId())
return true;
return ours->Matches(theirs);
}
@ -217,14 +217,14 @@ bool pyVaultNode::operator==(const pyVaultNode &vaultNode) const
uint32_t pyVaultNode::GetID( void )
{
if (fNode)
return fNode->nodeId;
return fNode->GetNodeId();
return 0;
}
uint32_t pyVaultNode::GetType( void )
{
if (fNode)
return fNode->nodeType;
return fNode->GetNodeType();
return 0;
}
@ -254,14 +254,14 @@ PyObject* pyVaultNode::GetOwnerNode( void )
uint32_t pyVaultNode::GetModifyTime( void )
{
if (fNode)
return fNode->modifyTime;
return fNode->GetModifyTime();
return 0;
}
uint32_t pyVaultNode::GetCreatorNodeID( void )
{
if (fNode)
return fNode->creatorId;
return fNode->GetCreatorId();
return 0;
}
@ -274,7 +274,7 @@ PyObject* pyVaultNode::GetCreatorNode( void )
templateNode->IncRef();
templateNode->SetNodeType(plVault::kNodeType_PlayerInfo);
VaultPlayerInfoNode plrInfo(templateNode);
plrInfo.SetPlayerId(fNode->creatorId);
plrInfo.SetPlayerId(fNode->GetCreatorId());
if (RelVaultNode * rvn = VaultGetNodeIncRef(templateNode)) {
result = pyVaultPlayerInfoNode::New(rvn);
@ -293,7 +293,7 @@ PyObject* pyVaultNode::GetCreatorNode( void )
uint32_t pyVaultNode::GetCreateTime( void )
{
if (fNode)
return fNode->createTime;
return fNode->GetCreateTime();
return 0;
}
@ -314,8 +314,8 @@ const char * pyVaultNode::GetCreateAgeName( void )
return fCreateAgeName;
if (fNode) {
if (fNode->createAgeName)
fCreateAgeName = StrDupToAnsi(fNode->createAgeName);
if (fNode->GetCreateAgeName())
fCreateAgeName = StrDupToAnsi(fNode->GetCreateAgeName());
else
fCreateAgeName = StrDup("");
}
@ -326,7 +326,7 @@ const char * pyVaultNode::GetCreateAgeName( void )
plUUID pyVaultNode::GetCreateAgeGuid(void) const
{
if (fNode) {
return fNode->createAgeUuid;
return fNode->GetCreateAgeUuid();
}
return kNilUuid;
@ -336,7 +336,7 @@ PyObject* pyVaultNode::GetCreateAgeCoords () {
if (!fNode)
PYTHON_RETURN_NONE;
return pyDniCoordinates::New(nil);
return pyDniCoordinates::New(nil);
}
void pyVaultNode::SetID( uint32_t v )
@ -347,7 +347,7 @@ void pyVaultNode::SetID( uint32_t v )
void pyVaultNode::SetType( int v )
{
ASSERT(fNode);
if (fNode->nodeId) {
if (fNode->GetNodeId()) {
FATAL("pyVaultNode: You may not change the type of a vault node");
return;
}
@ -363,7 +363,7 @@ void pyVaultNode::SetOwnerNodeID( uint32_t v )
void pyVaultNode::SetCreatorNodeID( uint32_t v )
{
ASSERT(fNode);
if (fNode->nodeId) {
if (fNode->GetNodeId()) {
FATAL("pyVaultNode: You may not change the type of a vault node");
return;
}
@ -415,7 +415,7 @@ PyObject* pyVaultNode::AddNode(pyVaultNode* pynode, PyObject* cbObject, uint32_t
if ( !pynode->GetID() )
{
// Block here until node is created and fetched =(
ASSERT(pynode->GetNode()->nodeType);
ASSERT(pynode->GetNode()->GetNodeType());
ENetError result;
RelVaultNode * newNode = VaultCreateNodeAndWaitIncRef(
pynode->GetNode(),
@ -435,10 +435,10 @@ PyObject* pyVaultNode::AddNode(pyVaultNode* pynode, PyObject* cbObject, uint32_t
PyObject* nodeRef = cb->fPyNodeRef = pyVaultNodeRef::New(fNode, pynode->fNode);
Py_INCREF(nodeRef); // The callback steals the ref, according to Eric...
cb->SetNode(pynode->fNode);
VaultAddChildNode(fNode->nodeId,
pynode->fNode->nodeId,
NetCommGetPlayer()->playerInt,
VaultAddChildNode(fNode->GetNodeId(),
pynode->fNode->GetNodeId(),
NetCommGetPlayer()->playerInt,
(FVaultAddChildNodeCallback)_AddNodeCallback,
cb
);
@ -474,8 +474,8 @@ void pyVaultNode::LinkToNode(int nodeID, PyObject* cbObject, uint32_t cbContext)
rvn->DecRef();
}
VaultAddChildNode(fNode->nodeId,
nodeID,
VaultAddChildNode(fNode->GetNodeId(),
nodeID,
NetCommGetPlayer()->playerInt,
(FVaultAddChildNodeCallback)_AddNodeCallback,
cb
@ -499,7 +499,7 @@ bool pyVaultNode::RemoveNode( pyVaultNode& pynode, PyObject* cbObject, uint32_t
// Hack the callbacks until vault notification is in place
cb->VaultOperationStarted( cbContext );
VaultRemoveChildNode(fNode->nodeId, pynode.fNode->nodeId, nil, nil);
VaultRemoveChildNode(fNode->GetNodeId(), pynode.fNode->GetNodeId(), nil, nil);
cb->SetNode(pynode.fNode);
cb->fPyNodeRef = pyVaultNodeRef::New(fNode, pynode.fNode);
@ -525,7 +525,7 @@ void pyVaultNode::RemoveAllNodes( void )
ARRAY(unsigned) nodeIds;
fNode->GetChildNodeIds(&nodeIds, 1);
for (unsigned i = 0; i < nodeIds.Count(); ++i)
VaultRemoveChildNode(fNode->nodeId, nodeIds[i], nil, nil);
VaultRemoveChildNode(fNode->GetNodeId(), nodeIds[i], nil, nil);
}
// Add/Save this node to vault
@ -533,7 +533,7 @@ void pyVaultNode::Save(PyObject* cbObject, uint32_t cbContext)
{
// If the node doesn't have an id, then use it as a template to create the node in the vault,
// otherwise just ignore the save request since vault nodes are now auto-saved.
if (!fNode->nodeId && fNode->nodeType) {
if (!fNode->GetNodeId() && fNode->GetNodeType()) {
ENetError result;
if (RelVaultNode * node = VaultCreateNodeAndWaitIncRef(fNode, &result)) {
fNode->DecRef();
@ -557,7 +557,7 @@ void pyVaultNode::SaveAll(PyObject* cbObject, uint32_t cbContext)
void pyVaultNode::ForceSave()
{
if (!fNode->nodeId && fNode->nodeType) {
if (!fNode->GetNodeId() && fNode->GetNodeType()) {
ENetError result;
if (RelVaultNode * node = VaultCreateNodeAndWaitIncRef(fNode, &result)) {
fNode->DecRef();
@ -576,7 +576,7 @@ void pyVaultNode::SendTo(uint32_t destClientNodeID, PyObject* cbObject, uint32_t
if (fNode)
{
// If the node doesn't have an id, then use it as a template to create the node in the vault,
if (!fNode->nodeId && fNode->nodeType) {
if (!fNode->GetNodeId() && fNode->GetNodeType()) {
ENetError result;
if (RelVaultNode * node = VaultCreateNodeAndWaitIncRef(fNode, &result)) {
fNode->DecRef();
@ -717,9 +717,9 @@ PyObject* pyVaultNode::UpcastToFolderNode()
if (!fNode)
PYTHON_RETURN_NONE;
if (
fNode->nodeType != plVault::kNodeType_Folder &&
fNode->nodeType != plVault::kNodeType_AgeInfoList &&
fNode->nodeType != plVault::kNodeType_PlayerInfoList
fNode->GetNodeType() != plVault::kNodeType_Folder &&
fNode->GetNodeType() != plVault::kNodeType_AgeInfoList &&
fNode->GetNodeType() != plVault::kNodeType_PlayerInfoList
)
PYTHON_RETURN_NONE;
@ -730,7 +730,7 @@ PyObject* pyVaultNode::UpcastToPlayerInfoListNode()
{
if (!fNode)
PYTHON_RETURN_NONE;
if (fNode->nodeType != plVault::kNodeType_PlayerInfoList)
if (fNode->GetNodeType() != plVault::kNodeType_PlayerInfoList)
PYTHON_RETURN_NONE;
return pyVaultPlayerInfoListNode::New(fNode);
@ -740,7 +740,7 @@ PyObject* pyVaultNode::UpcastToImageNode()
{
if (!fNode)
PYTHON_RETURN_NONE;
if (fNode->nodeType != plVault::kNodeType_Image)
if (fNode->GetNodeType() != plVault::kNodeType_Image)
PYTHON_RETURN_NONE;
return pyVaultImageNode::New(fNode);
@ -750,7 +750,7 @@ PyObject* pyVaultNode::UpcastToTextNoteNode()
{
if (!fNode)
PYTHON_RETURN_NONE;
if (fNode->nodeType != plVault::kNodeType_TextNote)
if (fNode->GetNodeType() != plVault::kNodeType_TextNote)
PYTHON_RETURN_NONE;
return pyVaultTextNoteNode::New(fNode);
@ -760,7 +760,7 @@ PyObject* pyVaultNode::UpcastToAgeLinkNode()
{
if (!fNode)
PYTHON_RETURN_NONE;
if (fNode->nodeType != plVault::kNodeType_AgeLink)
if (fNode->GetNodeType() != plVault::kNodeType_AgeLink)
PYTHON_RETURN_NONE;
return pyVaultAgeLinkNode::New(fNode);
@ -770,7 +770,7 @@ PyObject* pyVaultNode::UpcastToChronicleNode()
{
if (!fNode)
PYTHON_RETURN_NONE;
if (fNode->nodeType != plVault::kNodeType_Chronicle)
if (fNode->GetNodeType() != plVault::kNodeType_Chronicle)
PYTHON_RETURN_NONE;
return pyVaultChronicleNode::New(fNode);
@ -780,7 +780,7 @@ PyObject* pyVaultNode::UpcastToPlayerInfoNode()
{
if (!fNode)
PYTHON_RETURN_NONE;
if (fNode->nodeType != plVault::kNodeType_PlayerInfo)
if (fNode->GetNodeType() != plVault::kNodeType_PlayerInfo)
PYTHON_RETURN_NONE;
return pyVaultPlayerInfoNode::New(fNode);
@ -790,7 +790,7 @@ PyObject* pyVaultNode::UpcastToMarkerGameNode()
{
if (!fNode)
PYTHON_RETURN_NONE;
if (fNode->nodeType != plVault::kNodeType_MarkerGame)
if (fNode->GetNodeType() != plVault::kNodeType_MarkerGame)
PYTHON_RETURN_NONE;
return pyVaultMarkerGameNode::New(fNode);
@ -800,7 +800,7 @@ PyObject* pyVaultNode::UpcastToAgeInfoNode()
{
if (!fNode)
PYTHON_RETURN_NONE;
if (fNode->nodeType != plVault::kNodeType_AgeInfo)
if (fNode->GetNodeType() != plVault::kNodeType_AgeInfo)
PYTHON_RETURN_NONE;
return pyVaultAgeInfoNode::New(fNode);
@ -810,7 +810,7 @@ PyObject* pyVaultNode::UpcastToAgeInfoListNode()
{
if (!fNode)
PYTHON_RETURN_NONE;
if (fNode->nodeType != plVault::kNodeType_AgeInfoList)
if (fNode->GetNodeType() != plVault::kNodeType_AgeInfoList)
PYTHON_RETURN_NONE;
return pyVaultAgeInfoListNode::New(fNode);
@ -820,7 +820,7 @@ PyObject* pyVaultNode::UpcastToSDLNode()
{
if (!fNode)
PYTHON_RETURN_NONE;
if (fNode->nodeType != plVault::kNodeType_SDL)
if (fNode->GetNodeType() != plVault::kNodeType_SDL)
PYTHON_RETURN_NONE;
return pyVaultSDLNode::New(fNode);
@ -830,7 +830,7 @@ PyObject* pyVaultNode::UpcastToPlayerNode()
{
if (!fNode)
PYTHON_RETURN_NONE;
if (fNode->nodeType != plVault::kNodeType_VNodeMgrPlayer)
if (fNode->GetNodeType() != plVault::kNodeType_VNodeMgrPlayer)
PYTHON_RETURN_NONE;
return pyVaultPlayerNode::New(fNode);
@ -841,7 +841,7 @@ PyObject* pyVaultNode::UpcastToSystemNode()
{
if (!fNode)
PYTHON_RETURN_NONE;
if (fNode->nodeType != plVault::kNodeType_System)
if (fNode->GetNodeType() != plVault::kNodeType_System)
PYTHON_RETURN_NONE;
return pyVaultSystemNode::New(fNode);

20
Sources/Plasma/FeatureLib/pfPython/pyVaultNodeRef.cpp

@ -99,22 +99,22 @@ PyObject* pyVaultNodeRef::GetChild( void )
unsigned pyVaultNodeRef::GetParentID () {
if (!fParent)
return 0;
return fParent->nodeId;
return fParent->GetNodeId();
}
unsigned pyVaultNodeRef::GetChildID () {
if (!fChild)
return 0;
return fChild->nodeId;
return fChild->GetNodeId();
}
unsigned pyVaultNodeRef::GetSaverID () {
if (!fParent || !fChild)
return 0;
unsigned saverId = 0;
if (RelVaultNode * child = VaultGetNodeIncRef(fChild->nodeId)) {
saverId = child->GetRefOwnerId(fParent->nodeId);
unsigned saverId = 0;
if (RelVaultNode * child = VaultGetNodeIncRef(fChild->GetNodeId())) {
saverId = child->GetRefOwnerId(fParent->GetNodeId());
child->DecRef();
}
return saverId;
@ -124,9 +124,9 @@ PyObject * pyVaultNodeRef::GetSaver () {
if (!fParent || !fChild)
return 0;
RelVaultNode * saver = nil;
if (RelVaultNode * child = VaultGetNodeIncRef(fChild->nodeId)) {
if (unsigned saverId = child->GetRefOwnerId(fParent->nodeId)) {
RelVaultNode * saver = nil;
if (RelVaultNode * child = VaultGetNodeIncRef(fChild->GetNodeId())) {
if (unsigned saverId = child->GetRefOwnerId(fParent->GetNodeId())) {
// Find the player info node representing the saver
NetVaultNode * templateNode = new NetVaultNode;
templateNode->IncRef();
@ -163,6 +163,6 @@ bool pyVaultNodeRef::BeenSeen () {
void pyVaultNodeRef::SetSeen (bool v) {
if (!fParent || !fChild)
return;
fParent->SetSeen(fChild->nodeId, v);
fParent->SetSeen(fChild->GetNodeId(), v);
}

6
Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoListNode.cpp

@ -114,7 +114,7 @@ bool pyVaultPlayerInfoListNode::AddPlayer( uint32_t playerID )
VaultFindNodesAndWait(templateNode, &nodeIds);
if (nodeIds.Count())
VaultAddChildNodeAndWait(fNode->nodeId, nodeIds[0], VaultGetPlayerId());
VaultAddChildNodeAndWait(fNode->GetNodeId(), nodeIds[0], VaultGetPlayerId());
templateNode->DecRef();
return nodeIds.Count() != 0;
@ -130,9 +130,9 @@ void pyVaultPlayerInfoListNode::RemovePlayer( uint32_t playerID )
templateNode->SetNodeType(plVault::kNodeType_PlayerInfo);
VaultPlayerInfoNode access(templateNode);
access.SetPlayerId(playerID);
if (RelVaultNode * rvn = fNode->GetChildNodeIncRef(templateNode, 1)) {
VaultRemoveChildNode(fNode->nodeId, rvn->nodeId, nil, nil);
VaultRemoveChildNode(fNode->GetNodeId(), rvn->GetNodeId(), nil, nil);
rvn->DecRef();
}

18
Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoNode.cpp

@ -94,7 +94,7 @@ uint32_t pyVaultPlayerInfoNode::Player_GetPlayerID( void )
return 0;
VaultPlayerInfoNode playerInfo(fNode);
return playerInfo.playerId;
return playerInfo.GetPlayerId();
}
void pyVaultPlayerInfoNode::Player_SetPlayerName( const char * name )
@ -114,11 +114,11 @@ const char * pyVaultPlayerInfoNode::Player_GetPlayerName( void )
return "";
VaultPlayerInfoNode playerInfo(fNode);
if (!playerInfo.playerName)
if (!playerInfo.GetPlayerName())
return "";
free(ansiPlayerName);
ansiPlayerName = StrDupToAnsi(playerInfo.playerName);
ansiPlayerName = StrDupToAnsi(playerInfo.GetPlayerName());
return ansiPlayerName;
}
@ -129,7 +129,7 @@ void pyVaultPlayerInfoNode::Player_SetAgeInstanceName( const char * agename )
return;
wchar_t * wStr = StrDupToUnicode(agename);
VaultPlayerInfoNode playerInfo(fNode);
VaultPlayerInfoNode playerInfo(fNode);
playerInfo.SetAgeInstName(wStr);
free(wStr);
}
@ -140,11 +140,11 @@ const char * pyVaultPlayerInfoNode::Player_GetAgeInstanceName( void )
return "";
VaultPlayerInfoNode playerInfo(fNode);
if (!playerInfo.ageInstName)
if (!playerInfo.GetAgeInstName())
return "";
free(ansiAgeInstName);
ansiAgeInstName = StrDupToAnsi(playerInfo.ageInstName);
ansiAgeInstName = StrDupToAnsi(playerInfo.GetAgeInstName());
return ansiAgeInstName;
}
@ -162,7 +162,7 @@ plUUID pyVaultPlayerInfoNode::Player_GetAgeGuid(void) const
{
if (fNode) {
VaultPlayerInfoNode playerInfo(fNode);
return playerInfo.ageInstUuid;
return playerInfo.GetAgeInstUuid();
}
return kNilUuid;
}
@ -183,7 +183,7 @@ bool pyVaultPlayerInfoNode::Player_IsOnline( void )
return false;
VaultPlayerInfoNode playerInfo(fNode);
return playerInfo.online;
return playerInfo.GetOnline();
}
int pyVaultPlayerInfoNode::Player_GetCCRLevel( void )
@ -192,5 +192,5 @@ int pyVaultPlayerInfoNode::Player_GetCCRLevel( void )
return 0;
VaultPlayerInfoNode playerInfo(fNode);
return playerInfo.ccrLevel;
return playerInfo.GetCCRLevel();
}

14
Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerNode.cpp

@ -266,8 +266,8 @@ std::string pyVaultPlayerNode::GetPlayerName()
return "";
VaultPlayerNode player(fNode);
char ansiStr[MAX_PATH];
StrToAnsi(ansiStr, player.playerName, arrsize(ansiStr));
char ansiStr[MAX_PATH];
StrToAnsi(ansiStr, player.GetPlayerName(), arrsize(ansiStr));
return ansiStr;
}
@ -282,8 +282,8 @@ std::string pyVaultPlayerNode::GetAvatarShapeName()
return "";
VaultPlayerNode player(fNode);
char ansiStr[MAX_PATH];
StrToAnsi(ansiStr, player.avatarShapeName, arrsize(ansiStr));
char ansiStr[MAX_PATH];
StrToAnsi(ansiStr, player.GetAvatarShapeName(), arrsize(ansiStr));
return ansiStr;
}
@ -298,7 +298,7 @@ bool pyVaultPlayerNode::IsDisabled()
return false;
VaultPlayerNode player(fNode);
return player.disabled;
return player.GetDisabled();
}
void pyVaultPlayerNode::SetOnlineTime(uint32_t value)
@ -312,7 +312,7 @@ uint32_t pyVaultPlayerNode::GetOnlineTime()
return 0;
VaultPlayerNode player(fNode);
return player.onlineTime;
return player.GetOnlineTime();
}
void pyVaultPlayerNode::SetExplorer (bool b) {
@ -328,5 +328,5 @@ bool pyVaultPlayerNode::IsExplorer () {
return false;
VaultPlayerNode player(fNode);
return player.explorer;
return player.GetExplorer();
}

4
Sources/Plasma/FeatureLib/pfPython/pyVaultSDLNode.cpp

@ -76,7 +76,7 @@ void pyVaultSDLNode::SetIdent( int v )
return;
VaultSDLNode sdl(fNode);
sdl.SetSdlIdent(v);
sdl.SetSDLIdent(v);
}
int pyVaultSDLNode::GetIdent() const
@ -85,7 +85,7 @@ int pyVaultSDLNode::GetIdent() const
return 0;
VaultSDLNode sdl(fNode);
return sdl.sdlIdent;
return sdl.GetSDLIdent();
}
PyObject * pyVaultSDLNode::GetStateDataRecord() const

24
Sources/Plasma/FeatureLib/pfPython/pyVaultTextNoteNode.cpp

@ -101,9 +101,9 @@ std::string pyVaultTextNoteNode::Note_GetTitle( void )
char * aStr = nil;
VaultTextNoteNode textNote(fNode);
if (textNote.noteTitle) {
if (textNote.GetNoteTitle()) {
std::string result;
aStr = StrDupToAnsi(textNote.noteTitle);
aStr = StrDupToAnsi(textNote.GetNoteTitle());
result = aStr;
free(aStr);
return result;
@ -117,8 +117,8 @@ std::wstring pyVaultTextNoteNode::Note_GetTitleW( void )
return L"";
VaultTextNoteNode textNote(fNode);
if (textNote.noteTitle)
return textNote.noteTitle;
if (textNote.GetNoteTitle())
return textNote.GetNoteTitle();
return L"";
}
@ -151,9 +151,9 @@ std::string pyVaultTextNoteNode::Note_GetText( void )
char * aStr = nil;
VaultTextNoteNode textNote(fNode);
if (textNote.noteText) {
if (textNote.GetNoteText()) {
std::string result;
aStr = StrDupToAnsi(textNote.noteText);
aStr = StrDupToAnsi(textNote.GetNoteText());
result = aStr;
free(aStr);
return result;
@ -167,8 +167,8 @@ std::wstring pyVaultTextNoteNode::Note_GetTextW( void )
return L"";
VaultTextNoteNode textNote(fNode);
if (textNote.noteText)
return textNote.noteText;
if (textNote.GetNoteText())
return textNote.GetNoteText();
return L"";
}
@ -185,9 +185,9 @@ int32_t pyVaultTextNoteNode::Note_GetType( void )
{
if (!fNode)
return 0;
VaultTextNoteNode textNote(fNode);
return textNote.noteType;
return textNote.GetNoteType();
}
void pyVaultTextNoteNode::Note_SetSubType( int32_t type )
@ -203,9 +203,9 @@ int32_t pyVaultTextNoteNode::Note_GetSubType( void )
{
if (!fNode)
return 0;
VaultTextNoteNode textNote(fNode);
return textNote.noteSubType;
return textNote.GetNoteSubType();
}
PyObject * pyVaultTextNoteNode::GetDeviceInbox() const

546
Sources/Plasma/NucleusLib/pnNetProtocol/Private/pnNpCommon.cpp

@ -337,20 +337,20 @@ void NetGameRank::CopyFrom(const NetGameRank & fromRank) {
***/
//============================================================================
static void DeallocNodeFields (NetVaultNode * node) {
free(node->createAgeName);
free(node->string64_1);
free(node->string64_2);
free(node->string64_3);
free(node->string64_4);
free(node->string64_5);
free(node->string64_6);
free(node->istring64_1);
free(node->istring64_2);
free(node->text_1);
free(node->text_2);
free(node->blob_1);
free(node->blob_2);
void NetVaultNode::DeallocNodeFields () {
free(createAgeName);
free(string64_1);
free(string64_2);
free(string64_3);
free(string64_4);
free(string64_5);
free(string64_6);
free(istring64_1);
free(istring64_2);
free(text_1);
free(text_2);
free(blob_1);
free(blob_2);
}
//============================================================================
@ -369,70 +369,59 @@ NetVaultNode::NetVaultNode ()
//============================================================================
NetVaultNode::~NetVaultNode () {
DeallocNodeFields(this);
DeallocNodeFields();
}
//============================================================================
unsigned NetVaultNode::Read_LCS (const uint8_t inbuffer[], unsigned bufsz, unsigned rwOpts) {
DeallocNodeFields(this);
DeallocNodeFields();
uint8_t * buffer = const_cast<uint8_t *>(inbuffer);
uint8_t * start = buffer;
IReadValue(&fieldFlags, &buffer, &bufsz);
for (uint64_t bit = 1; bit; bit <<= 1) {
// if we've passed all fields on the node then bail
if (bit > fieldFlags)
break;
// if this field isn't in the set to be read, then continue to next
if (!(bit & fieldFlags))
continue;
#define READ(flag, func, varptr) if (flag & fieldFlags) func(varptr, &buffer, &bufsz);
#define READARR(flag, func, varptr, lenptr) if (flag & fieldFlags) func(varptr, lenptr, &buffer, &bufsz);
READ(kNodeId, IReadValue, &nodeId);
READ(kCreateTime, IReadValue, &createTime);
READ(kModifyTime, IReadValue, &modifyTime);
READ(kCreateAgeName,IReadString, &createAgeName);
READ(kCreateAgeUuid,IReadValue, &createAgeUuid);
READ(kCreatorAcct, IReadValue, &creatorAcct);
READ(kCreatorId, IReadValue, &creatorId);
READ(kNodeType, IReadValue, &nodeType);
READ(kInt32_1, IReadValue, &int32_1);
READ(kInt32_2, IReadValue, &int32_2);
READ(kInt32_3, IReadValue, &int32_3);
READ(kInt32_4, IReadValue, &int32_4);
READ(kUInt32_1, IReadValue, &uint32_1);
READ(kUInt32_2, IReadValue, &uint32_2);
READ(kUInt32_3, IReadValue, &uint32_3);
READ(kUInt32_4, IReadValue, &uint32_4);
READ(kUuid_1, IReadValue, &uuid_1);
READ(kUuid_2, IReadValue, &uuid_2);
READ(kUuid_3, IReadValue, &uuid_3);
READ(kUuid_4, IReadValue, &uuid_4);
READ(kString64_1, IReadString, &string64_1);
READ(kString64_2, IReadString, &string64_2);
READ(kString64_3, IReadString, &string64_3);
READ(kString64_4, IReadString, &string64_4);
READ(kString64_5, IReadString, &string64_5);
READ(kString64_6, IReadString, &string64_6);
READ(kIString64_1, IReadString, &istring64_1);
READ(kIString64_2, IReadString, &istring64_2);
READ(kText_1, IReadString, &text_1);
READ(kText_2, IReadString, &text_2);
READARR(kBlob_1, IReadArray, &blob_1, &blob_1Length);
READARR(kBlob_2, IReadArray, &blob_2, &blob_2Length);
#undef READARR
#undef READ
if (fieldFlags & ~kAllValidFields)
FATAL("Invalid field flag(s) encountered");
#define READ(flag, func, varptr) case flag: func(varptr, &buffer, &bufsz); break
#define READARR(flag, func, varptr, lenptr) case flag: func(varptr, lenptr, &buffer, &bufsz); break
switch (bit) {
READ(kNodeId, IReadValue, &nodeId);
READ(kCreateTime, IReadValue, &createTime);
READ(kModifyTime, IReadValue, &modifyTime);
READ(kCreateAgeName,IReadString, &createAgeName);
READ(kCreateAgeUuid,IReadValue, &createAgeUuid);
READ(kCreatorAcct, IReadValue, &creatorAcct);
READ(kCreatorId, IReadValue, &creatorId);
READ(kNodeType, IReadValue, &nodeType);
READ(kInt32_1, IReadValue, &int32_1);
READ(kInt32_2, IReadValue, &int32_2);
READ(kInt32_3, IReadValue, &int32_3);
READ(kInt32_4, IReadValue, &int32_4);
READ(kUInt32_1, IReadValue, &uint32_1);
READ(kUInt32_2, IReadValue, &uint32_2);
READ(kUInt32_3, IReadValue, &uint32_3);
READ(kUInt32_4, IReadValue, &uint32_4);
READ(kUuid_1, IReadValue, &uuid_1);
READ(kUuid_2, IReadValue, &uuid_2);
READ(kUuid_3, IReadValue, &uuid_3);
READ(kUuid_4, IReadValue, &uuid_4);
READ(kString64_1, IReadString, &string64_1);
READ(kString64_2, IReadString, &string64_2);
READ(kString64_3, IReadString, &string64_3);
READ(kString64_4, IReadString, &string64_4);
READ(kString64_5, IReadString, &string64_5);
READ(kString64_6, IReadString, &string64_6);
READ(kIString64_1, IReadString, &istring64_1);
READ(kIString64_2, IReadString, &istring64_2);
READ(kText_1, IReadString, &text_1);
READ(kText_2, IReadString, &text_2);
READARR(kBlob_1, IReadArray, &blob_1, &blob_1Length);
READARR(kBlob_2, IReadArray, &blob_2, &blob_2Length);
DEFAULT_FATAL(bit);
}
#undef READARR
#undef READ
}
if (rwOpts & kRwUpdateDirty)
dirtyFlags = fieldFlags;
else
@ -455,57 +444,46 @@ unsigned NetVaultNode::Write_LCS (ARRAY(uint8_t) * buffer, unsigned rwOpts) {
return 0;
IWriteValue(flags, buffer);
for (uint64_t bit = 1; bit; bit <<= 1) {
// if we've passed all fields on the node then bail
if (bit > flags)
break;
// if this field isn't in the set to be written, then continue to next
if (!(bit & flags))
continue;
#define WRITE(flag, func, var) case flag: func(var, buffer); break
#define WRITEARR(flag, func, var, len) case flag: func(var, len, buffer); break
switch (bit) {
WRITE(kNodeId, IWriteValue, nodeId );
WRITE(kCreateTime, IWriteValue, createTime );
WRITE(kModifyTime, IWriteValue, modifyTime );
WRITE(kCreateAgeName, IWriteString, createAgeName ? createAgeName : L"" );
WRITE(kCreateAgeUuid, IWriteValue, createAgeUuid );
WRITE(kCreatorAcct, IWriteValue, creatorAcct );
WRITE(kCreatorId, IWriteValue, creatorId );
WRITE(kNodeType, IWriteValue, nodeType );
WRITE(kInt32_1, IWriteValue, int32_1 );
WRITE(kInt32_2, IWriteValue, int32_2 );
WRITE(kInt32_3, IWriteValue, int32_3 );
WRITE(kInt32_4, IWriteValue, int32_4 );
WRITE(kUInt32_1, IWriteValue, uint32_1 );
WRITE(kUInt32_2, IWriteValue, uint32_2 );
WRITE(kUInt32_3, IWriteValue, uint32_3 );
WRITE(kUInt32_4, IWriteValue, uint32_4 );
WRITE(kUuid_1, IWriteValue, uuid_1 );
WRITE(kUuid_2, IWriteValue, uuid_2 );
WRITE(kUuid_3, IWriteValue, uuid_3 );
WRITE(kUuid_4, IWriteValue, uuid_4 );
WRITE(kString64_1, IWriteString, string64_1 ? string64_1 : L"" );
WRITE(kString64_2, IWriteString, string64_2 ? string64_2 : L"" );
WRITE(kString64_3, IWriteString, string64_3 ? string64_3 : L"" );
WRITE(kString64_4, IWriteString, string64_4 ? string64_4 : L"" );
WRITE(kString64_5, IWriteString, string64_5 ? string64_5 : L"" );
WRITE(kString64_6, IWriteString, string64_6 ? string64_6 : L"" );
WRITE(kIString64_1, IWriteString, istring64_1 ? istring64_1 : L"" );
WRITE(kIString64_2, IWriteString, istring64_2 ? istring64_2 : L"" );
WRITE(kText_1, IWriteString, text_1 ? text_1 : L"" );
WRITE(kText_2, IWriteString, text_2 ? text_2 : L"" );
WRITEARR(kBlob_1, IWriteArray, blob_1, blob_1Length);
WRITEARR(kBlob_2, IWriteArray, blob_2, blob_2Length);
DEFAULT_FATAL(bit);
}
#undef WRITEARR
#undef WRITE
}
#define WRITE(flag, func, var) if (flag & flags) func(var, buffer);
#define WRITEARR(flag, func, var, len) if (flag & flags) func(var, len, buffer);
WRITE(kNodeId, IWriteValue, nodeId );
WRITE(kCreateTime, IWriteValue, createTime );
WRITE(kModifyTime, IWriteValue, modifyTime );
WRITE(kCreateAgeName, IWriteString, createAgeName ? createAgeName : L"" );
WRITE(kCreateAgeUuid, IWriteValue, createAgeUuid );
WRITE(kCreatorAcct, IWriteValue, creatorAcct );
WRITE(kCreatorId, IWriteValue, creatorId );
WRITE(kNodeType, IWriteValue, nodeType );
WRITE(kInt32_1, IWriteValue, int32_1 );
WRITE(kInt32_2, IWriteValue, int32_2 );
WRITE(kInt32_3, IWriteValue, int32_3 );
WRITE(kInt32_4, IWriteValue, int32_4 );
WRITE(kUInt32_1, IWriteValue, uint32_1 );
WRITE(kUInt32_2, IWriteValue, uint32_2 );
WRITE(kUInt32_3, IWriteValue, uint32_3 );
WRITE(kUInt32_4, IWriteValue, uint32_4 );
WRITE(kUuid_1, IWriteValue, uuid_1 );
WRITE(kUuid_2, IWriteValue, uuid_2 );
WRITE(kUuid_3, IWriteValue, uuid_3 );
WRITE(kUuid_4, IWriteValue, uuid_4 );
WRITE(kString64_1, IWriteString, string64_1 ? string64_1 : L"" );
WRITE(kString64_2, IWriteString, string64_2 ? string64_2 : L"" );
WRITE(kString64_3, IWriteString, string64_3 ? string64_3 : L"" );
WRITE(kString64_4, IWriteString, string64_4 ? string64_4 : L"" );
WRITE(kString64_5, IWriteString, string64_5 ? string64_5 : L"" );
WRITE(kString64_6, IWriteString, string64_6 ? string64_6 : L"" );
WRITE(kIString64_1, IWriteString, istring64_1 ? istring64_1 : L"" );
WRITE(kIString64_2, IWriteString, istring64_2 ? istring64_2 : L"" );
WRITE(kText_1, IWriteString, text_1 ? text_1 : L"" );
WRITE(kText_2, IWriteString, text_2 ? text_2 : L"" );
WRITEARR(kBlob_1, IWriteArray, blob_1, blob_1Length);
WRITEARR(kBlob_2, IWriteArray, blob_2, blob_2Length);
#undef WRITEARR
#undef WRITE
if (flags & ~kAllValidFields)
FATAL("Invalid field flag(s) encountered");
if (rwOpts & kRwUpdateDirty)
dirtyFlags = 0;
@ -520,7 +498,7 @@ bool NetVaultNode::Matches (const NetVaultNode * other) {
// if bit has gone past all set fields on the other node without failing, return true
if (bit > other->fieldFlags)
return true;
// if the other node does not have the field, then continue to next field
if (!(bit & other->fieldFlags))
continue;
@ -528,7 +506,7 @@ bool NetVaultNode::Matches (const NetVaultNode * other) {
// if we don't have the field (but the other node does), then return false
if (!(bit & fieldFlags))
return false;
#define COMPARE(flag, func, var) case flag: if (!func(var, other->var)) return false; break
switch (bit) {
COMPARE(kNodeId, ICompareValue, nodeId);
@ -574,16 +552,16 @@ bool NetVaultNode::Matches (const NetVaultNode * other) {
void NetVaultNode::CopyFrom (const NetVaultNode * other, unsigned copyOpts) {
if (this == other)
return;
uint64_t origDirtyFlags = dirtyFlags;
for (uint64_t bit = 1; bit; bit <<= 1) {
// we already have a value for this field...
if (bit & fieldFlags) {
if (!(copyOpts & kCopyOverwrite))
continue; // don't overwrite our field value
}
// other does not have a value for this field...
if (!(bit & other->fieldFlags)) {
// clear our field?
@ -591,10 +569,10 @@ void NetVaultNode::CopyFrom (const NetVaultNode * other, unsigned copyOpts) {
continue;
// clear our field.
if (bit & fieldFlags) {
#define _ZERO(flag, func, var, z) case flag: func(bit, this, &var, z); break
#define _ZEROSTRING(flag, func, var, z) case flag: func(bit, this, &var, z, kMaxVaultNodeStringLength); break
#define _ZEROCLOB(flag, func, var, z) case flag: func(bit, this, &var, z, (unsigned)-1); break
#define _ZEROARR(flag, func, var, varlen) case flag: func(bit, this, &var, &varlen, nil, 0); break
#define _ZERO(flag, func, var, z) case flag: func(bit, &var, z); break
#define _ZEROSTRING(flag, func, var, z) case flag: func(bit, &var, z, kMaxVaultNodeStringLength); break
#define _ZEROCLOB(flag, func, var, z) case flag: func(bit, &var, z, (unsigned)-1); break
#define _ZEROARR(flag, func, var, varlen) case flag: func(bit, &var, &varlen, nil, 0); break
switch (bit) {
_ZERO(kNodeId, IVaultNodeSetValue, nodeId, (unsigned)0);
_ZERO(kCreateTime, IVaultNodeSetValue, createTime, (unsigned)0);
@ -637,10 +615,10 @@ void NetVaultNode::CopyFrom (const NetVaultNode * other, unsigned copyOpts) {
}
}
#define COPY(flag, func, var) case flag: func(bit, this, &var, other->var); break
#define COPYSTRING(flag, func, var) case flag: func(bit, this, &var, other->var, kMaxVaultNodeStringLength); break
#define COPYCLOB(flag, func, var) case flag: func(bit, this, &var, other->var, (unsigned)-1); break
#define COPYARR(flag, func, var, varlen) case flag: func(bit, this, &var, &varlen, other->var, other->varlen); break
#define COPY(flag, func, var) case flag: func(bit, &var, other->var); break
#define COPYSTRING(flag, func, var) case flag: func(bit, &var, other->var, kMaxVaultNodeStringLength); break
#define COPYCLOB(flag, func, var) case flag: func(bit, &var, other->var, (unsigned)-1); break
#define COPYARR(flag, func, var, varlen) case flag: func(bit, &var, &varlen, other->var, other->varlen); break
switch (bit) {
COPY(kNodeId, IVaultNodeSetValue, nodeId );
COPY(kCreateTime, IVaultNodeSetValue, createTime );
@ -688,408 +666,162 @@ void NetVaultNode::CopyFrom (const NetVaultNode * other, unsigned copyOpts) {
//============================================================================
void NetVaultNode::SetNodeId (unsigned v) {
IVaultNodeSetValue(kNodeId, this, &nodeId, v);
IVaultNodeSetValue(kNodeId, &nodeId, v);
}
//============================================================================
void NetVaultNode::SetCreateTime (unsigned v) {
IVaultNodeSetValue(kCreateTime, this, &createTime, v);
IVaultNodeSetValue(kCreateTime, &createTime, v);
}
//============================================================================
void NetVaultNode::SetModifyTime (unsigned v) {
IVaultNodeSetValue(kModifyTime, this, &modifyTime, v);
IVaultNodeSetValue(kModifyTime, &modifyTime, v);
}
//============================================================================
void NetVaultNode::SetCreateAgeName (const wchar_t v[]) {
IVaultNodeSetString(kCreateAgeName, this, &createAgeName, v, kMaxVaultNodeStringLength);
IVaultNodeSetString(kCreateAgeName, &createAgeName, v, kMaxVaultNodeStringLength);
}
//============================================================================
void NetVaultNode::SetCreateAgeUuid (const plUUID& v) {
IVaultNodeSetValue(kCreateAgeUuid, this, &createAgeUuid, v);
IVaultNodeSetValue(kCreateAgeUuid, &createAgeUuid, v);
}
//============================================================================
void NetVaultNode::SetCreatorAcct (const plUUID& v) {
IVaultNodeSetValue(kCreatorAcct, this, &creatorAcct, v);
IVaultNodeSetValue(kCreatorAcct, &creatorAcct, v);
}
//============================================================================
void NetVaultNode::SetCreatorId (unsigned v) {
IVaultNodeSetValue(kCreatorId, this, &creatorId, v);
IVaultNodeSetValue(kCreatorId, &creatorId, v);
}
//============================================================================
void NetVaultNode::SetNodeType (unsigned v) {
IVaultNodeSetValue(kNodeType, this, &nodeType, v);
IVaultNodeSetValue(kNodeType, &nodeType, v);
}
//============================================================================
void NetVaultNode::SetInt32_1 (int v) {
IVaultNodeSetValue(kInt32_1, this, &int32_1, v);
IVaultNodeSetValue(kInt32_1, &int32_1, v);
}
//============================================================================
void NetVaultNode::SetInt32_2 (int v) {
IVaultNodeSetValue(kInt32_2, this, &int32_2, v);
IVaultNodeSetValue(kInt32_2, &int32_2, v);
}
//============================================================================
void NetVaultNode::SetInt32_3 (int v) {
IVaultNodeSetValue(kInt32_3, this, &int32_3, v);
IVaultNodeSetValue(kInt32_3, &int32_3, v);
}
//============================================================================
void NetVaultNode::SetInt32_4 (int v) {
IVaultNodeSetValue(kInt32_4, this, &int32_4, v);
IVaultNodeSetValue(kInt32_4, &int32_4, v);
}
//============================================================================
void NetVaultNode::SetUInt32_1 (unsigned v) {
IVaultNodeSetValue(kUInt32_1, this, &uint32_1, v);
IVaultNodeSetValue(kUInt32_1, &uint32_1, v);
}
//============================================================================
void NetVaultNode::SetUInt32_2 (unsigned v) {
IVaultNodeSetValue(kUInt32_2, this, &uint32_2, v);
IVaultNodeSetValue(kUInt32_2, &uint32_2, v);
}
//============================================================================
void NetVaultNode::SetUInt32_3 (unsigned v) {
IVaultNodeSetValue(kUInt32_3, this, &uint32_3, v);
IVaultNodeSetValue(kUInt32_3, &uint32_3, v);
}
//============================================================================
void NetVaultNode::SetUInt32_4 (unsigned v) {
IVaultNodeSetValue(kUInt32_4, this, &uint32_4, v);
IVaultNodeSetValue(kUInt32_4, &uint32_4, v);
}
//============================================================================
void NetVaultNode::SetUuid_1 (const plUUID& v) {
IVaultNodeSetValue(kUuid_1, this, &uuid_1, v);
IVaultNodeSetValue(kUuid_1, &uuid_1, v);
}
//============================================================================
void NetVaultNode::SetUuid_2 (const plUUID& v) {
IVaultNodeSetValue(kUuid_2, this, &uuid_2, v);
IVaultNodeSetValue(kUuid_2, &uuid_2, v);
}
//============================================================================
void NetVaultNode::SetUuid_3 (const plUUID& v) {
IVaultNodeSetValue(kUuid_3, this, &uuid_3, v);
IVaultNodeSetValue(kUuid_3, &uuid_3, v);
}
//============================================================================
void NetVaultNode::SetUuid_4 (const plUUID& v) {
IVaultNodeSetValue(kUuid_4, this, &uuid_4, v);
IVaultNodeSetValue(kUuid_4, &uuid_4, v);
}
//============================================================================
void NetVaultNode::SetString64_1 (const wchar_t v[]) {
IVaultNodeSetString(kString64_1, this, &string64_1, v, kMaxVaultNodeStringLength);
IVaultNodeSetString(kString64_1, &string64_1, v, kMaxVaultNodeStringLength);
}
//============================================================================
void NetVaultNode::SetString64_2 (const wchar_t v[]) {
IVaultNodeSetString(kString64_2, this, &string64_2, v, kMaxVaultNodeStringLength);
IVaultNodeSetString(kString64_2, &string64_2, v, kMaxVaultNodeStringLength);
}
//============================================================================
void NetVaultNode::SetString64_3 (const wchar_t v[]) {
IVaultNodeSetString(kString64_3, this, &string64_3, v, kMaxVaultNodeStringLength);
IVaultNodeSetString(kString64_3, &string64_3, v, kMaxVaultNodeStringLength);
}
//============================================================================
void NetVaultNode::SetString64_4 (const wchar_t v[]) {
IVaultNodeSetString(kString64_4, this, &string64_4, v, kMaxVaultNodeStringLength);
IVaultNodeSetString(kString64_4, &string64_4, v, kMaxVaultNodeStringLength);
}
//============================================================================
void NetVaultNode::SetString64_5 (const wchar_t v[]) {
IVaultNodeSetString(kString64_5, this, &string64_5, v, kMaxVaultNodeStringLength);
IVaultNodeSetString(kString64_5, &string64_5, v, kMaxVaultNodeStringLength);
}
//============================================================================
void NetVaultNode::SetString64_6 (const wchar_t v[]) {
IVaultNodeSetString(kString64_6, this, &string64_6, v, kMaxVaultNodeStringLength);
IVaultNodeSetString(kString64_6, &string64_6, v, kMaxVaultNodeStringLength);
}
//============================================================================
void NetVaultNode::SetIString64_1 (const wchar_t v[]) {
IVaultNodeSetString(kIString64_1, this, &istring64_1, v, kMaxVaultNodeStringLength);
IVaultNodeSetString(kIString64_1, &istring64_1, v, kMaxVaultNodeStringLength);
}
//============================================================================
void NetVaultNode::SetIString64_2 (const wchar_t v[]) {
IVaultNodeSetString(kIString64_2, this, &istring64_2, v, kMaxVaultNodeStringLength);
IVaultNodeSetString(kIString64_2, &istring64_2, v, kMaxVaultNodeStringLength);
}
//============================================================================
void NetVaultNode::SetText_1 (const wchar_t v[]) {
IVaultNodeSetString(kText_1, this, &text_1, v, (unsigned)-1);
IVaultNodeSetString(kText_1, &text_1, v, (unsigned)-1);
}
//============================================================================
void NetVaultNode::SetText_2 (const wchar_t v[]) {
IVaultNodeSetString(kText_2, this, &text_2, v, (unsigned)-1);
IVaultNodeSetString(kText_2, &text_2, v, (unsigned)-1);
}
//============================================================================
void NetVaultNode::SetBlob_1 (const uint8_t v[], unsigned len) {
IVaultNodeSetBlob(kBlob_1, this, &blob_1, &blob_1Length, v, len);
IVaultNodeSetBlob(kBlob_1, &blob_1, &blob_1Length, v, len);
}
//============================================================================
void NetVaultNode::SetBlob_2 (const uint8_t v[], unsigned len) {
IVaultNodeSetBlob(kBlob_2, this, &blob_2, &blob_2Length, v, len);
}
//============================================================================
void NetVaultNode::SetText (uint64_t fieldFlag, const wchar_t v[]) {
switch (fieldFlag) {
case kText_1: SetText_1(v); break;
case kText_2: SetText_2(v); break;
DEFAULT_FATAL(fieldFlag);
}
}
//============================================================================
void NetVaultNode::SetBlob (uint64_t fieldFlag, const uint8_t v[], unsigned len) {
switch (fieldFlag) {
case kBlob_1: SetBlob_1(v, len); break;
case kBlob_2: SetBlob_2(v, len); break;
DEFAULT_FATAL(fieldFlag);
}
}
/*****************************************************************************
*
* NetVaultNodeFieldArray
*
***/
//============================================================================
NetVaultNodeFieldArray::NetVaultNodeFieldArray (NetVaultNode * node)
: node(node)
{
node->IncRef("FieldArray");
fields.Add(Field(&node->nodeId, L"NodeId"));
fields.Add(Field(&node->createTime, L"CreateTime"));
fields.Add(Field(&node->modifyTime, L"ModifyTime"));
fields.Add(Field(&node->createAgeName, L"CreateAgeName"));
fields.Add(Field(&node->createAgeUuid, L"CreateAgeUuid"));
fields.Add(Field(&node->creatorAcct, L"CreatorAcctId"));
fields.Add(Field(&node->creatorId, L"CreatorId"));
fields.Add(Field(&node->nodeType, L"NodeType"));
fields.Add(Field(&node->int32_1, L"Int32_1"));
fields.Add(Field(&node->int32_2, L"Int32_2"));
fields.Add(Field(&node->int32_3, L"Int32_3"));
fields.Add(Field(&node->int32_4, L"Int32_4"));
fields.Add(Field(&node->uint32_1, L"UInt32_1"));
fields.Add(Field(&node->uint32_2, L"UInt32_2"));
fields.Add(Field(&node->uint32_3, L"UInt32_3"));
fields.Add(Field(&node->uint32_4, L"UInt32_4"));
fields.Add(Field(&node->uuid_1, L"Uuid_1"));
fields.Add(Field(&node->uuid_2, L"Uuid_2"));
fields.Add(Field(&node->uuid_3, L"Uuid_3"));
fields.Add(Field(&node->uuid_4, L"Uuid_4"));
fields.Add(Field(&node->string64_1, L"String64_1"));
fields.Add(Field(&node->string64_2, L"String64_2"));
fields.Add(Field(&node->string64_3, L"String64_3"));
fields.Add(Field(&node->string64_4, L"String64_4"));
fields.Add(Field(&node->string64_5, L"String64_5"));
fields.Add(Field(&node->string64_6, L"String64_6"));
fields.Add(Field(&node->istring64_1, L"IString64_1"));
fields.Add(Field(&node->istring64_2, L"IString64_2"));
fields.Add(Field(&node->text_1, L"Text_1"));
fields.Add(Field(&node->text_2, L"Text_2"));
fields.Add(Field(&node->blob_1, L"Blob_1"));
fields.Add(Field(&node->blob_2, L"Blob_2"));
}
//============================================================================
NetVaultNodeFieldArray::~NetVaultNodeFieldArray () {
fields.Clear();
node->DecRef("FieldArray");
}
//============================================================================
void * NetVaultNodeFieldArray::GetFieldAddress (uint64_t bit) {
ASSERT(bit);
unsigned index = 0;
for (uint64_t b = bit; b > 1; b >>= 1)
++index;
// do not return blob fields
if (index < fields.Count() - kNumBlobFields)
return fields[index].addr;
else
return nil;
}
//============================================================================
const wchar_t * NetVaultNodeFieldArray::GetFieldName (uint64_t bit) {
ASSERT(bit);
unsigned index = 0;
for (uint64_t b = bit; b > 1; b >>= 1)
++index;
ASSERT(index < fields.Count());
return fields[index].name;
}
//============================================================================
void NetVaultNodeFieldArray::GetFieldValueString_LCS (
uint64_t bit,
wchar_t * dst,
unsigned dstChars
) {
void * fieldAddr = GetFieldAddress(bit);
switch (bit) {
case NetVaultNode::kNodeId:
case NetVaultNode::kCreatorId:
case NetVaultNode::kCreateTime:
case NetVaultNode::kModifyTime:
case NetVaultNode::kNodeType:
case NetVaultNode::kUInt32_1:
case NetVaultNode::kUInt32_2:
case NetVaultNode::kUInt32_3:
case NetVaultNode::kUInt32_4:
StrPrintf(dst, dstChars, L"%u", *(unsigned *)fieldAddr);
break;
case NetVaultNode::kInt32_1:
case NetVaultNode::kInt32_2:
case NetVaultNode::kInt32_3:
case NetVaultNode::kInt32_4:
StrPrintf(dst, dstChars, L"%i", *(int *)fieldAddr);
break;
case NetVaultNode::kCreateAgeUuid:
case NetVaultNode::kCreatorAcct:
case NetVaultNode::kUuid_1:
case NetVaultNode::kUuid_2:
case NetVaultNode::kUuid_3:
case NetVaultNode::kUuid_4: {
plString tmp = reinterpret_cast<plUUID*>(fieldAddr)->AsString();
StrPrintf(dst, dstChars, L"hextoraw('%s')", tmp.c_str());
}
break;
case NetVaultNode::kCreateAgeName:
case NetVaultNode::kString64_1:
case NetVaultNode::kString64_2:
case NetVaultNode::kString64_3:
case NetVaultNode::kString64_4:
case NetVaultNode::kString64_5:
case NetVaultNode::kString64_6:
case NetVaultNode::kIString64_1:
case NetVaultNode::kIString64_2: {
wchar_t * tmp = (wchar_t*)malloc(sizeof(wchar_t) * dstChars);
IStrSqlEscape(*(wchar_t **)fieldAddr, tmp, dstChars);
StrPrintf(dst, dstChars, L"'%s'", tmp);
free(tmp);
}
break;
// FIELD(Text_1);
// FIELD(Text_2);
// FIELD(Blob_1);
// FIELD(Blob_2);
DEFAULT_FATAL(bit);
}
}
//============================================================================
void NetVaultNodeFieldArray::BuildWhereClause_LCS (
EWhereCondition condition,
wchar_t * dst,
unsigned dstChars
) {
if (!dstChars)
return;
dst[0] = 0;
static const wchar_t * s_conditionStrs[] = {
L" AND ",
L" OR "
};
unsigned fieldCount = 0;
for (uint64_t bit = 1; bit; bit <<= 1) {
if (!(bit & node->fieldFlags))
continue;
if (fieldCount++)
StrPack(dst, s_conditionStrs[condition], dstChars);
wchar_t str[256];
GetFieldValueString_LCS(bit, str, arrsize(str));
StrPack(dst, GetFieldName(bit), dstChars);
StrPack(dst, L"=", dstChars);
StrPack(dst, str, dstChars);
}
}
//============================================================================
NetVaultNodeFieldArray::ESqlType NetVaultNodeFieldArray::GetSqlType_LCS (uint64_t bit) {
switch (bit) {
case NetVaultNode::kNodeId:
case NetVaultNode::kCreatorId:
case NetVaultNode::kCreateTime:
case NetVaultNode::kModifyTime:
case NetVaultNode::kNodeType:
case NetVaultNode::kUInt32_1:
case NetVaultNode::kUInt32_2:
case NetVaultNode::kUInt32_3:
case NetVaultNode::kUInt32_4:
return kSqlUInt32;
case NetVaultNode::kInt32_1:
case NetVaultNode::kInt32_2:
case NetVaultNode::kInt32_3:
case NetVaultNode::kInt32_4:
return kSqlInt32;
case NetVaultNode::kCreateAgeUuid:
case NetVaultNode::kCreatorAcct:
case NetVaultNode::kUuid_1:
case NetVaultNode::kUuid_2:
case NetVaultNode::kUuid_3:
case NetVaultNode::kUuid_4:
return kSqlUuid;
case NetVaultNode::kCreateAgeName:
case NetVaultNode::kString64_1:
case NetVaultNode::kString64_2:
case NetVaultNode::kString64_3:
case NetVaultNode::kString64_4:
case NetVaultNode::kString64_5:
case NetVaultNode::kString64_6:
case NetVaultNode::kIString64_1:
case NetVaultNode::kIString64_2:
return kSqlString;
case NetVaultNode::kText_1:
case NetVaultNode::kText_2:
return kSqlCLob;
// case NetVaultNode::kBlob_1:
// case NetVaultNode::kBlob_1:
// return kSqlBlob:
default:
return kSqlInvalid;
}
IVaultNodeSetBlob(kBlob_2, &blob_2, &blob_2Length, v, len);
}

351
Sources/Plasma/NucleusLib/pnNetProtocol/Private/pnNpCommon.h

@ -205,32 +205,35 @@ struct NetVaultNode : AtomicRef {
static const uint64_t kText_2 = (uint64_t)1<<29;
static const uint64_t kBlob_1 = (uint64_t)1<<30;
static const uint64_t kBlob_2 = (uint64_t)1<<31;
static const uint64_t kAllValidFields = 0x00000000FFFFFFFFULL;
CCritSect critsect;
plUUID revisionId;
private:
uint64_t fieldFlags;
uint64_t dirtyFlags;
plUUID revisionId;
// Treat these as read-only or node flag fields will become invalid
// Threaded apps: Must be accessed with node->critsect locked
unsigned nodeId;
unsigned createTime;
unsigned modifyTime;
uint32_t nodeId;
uint32_t createTime;
uint32_t modifyTime;
wchar_t * createAgeName;
plUUID createAgeUuid;
plUUID creatorAcct; // accountId of node creator
unsigned creatorId; // playerId of node creator
unsigned nodeType;
int int32_1;
int int32_2;
int int32_3;
int int32_4;
unsigned uint32_1;
unsigned uint32_2;
unsigned uint32_3;
unsigned uint32_4;
uint32_t creatorId; // playerId of node creator
uint32_t nodeType;
int32_t int32_1;
int32_t int32_2;
int32_t int32_3;
int32_t int32_4;
uint32_t uint32_1;
uint32_t uint32_2;
uint32_t uint32_3;
uint32_t uint32_4;
plUUID uuid_1;
plUUID uuid_2;
plUUID uuid_3;
@ -245,40 +248,113 @@ struct NetVaultNode : AtomicRef {
wchar_t * istring64_2;
wchar_t * text_1;
wchar_t * text_2;
uint8_t * blob_1; uint32_t blob_1Length;
uint8_t * blob_2; uint32_t blob_2Length;
uint8_t * blob_1; size_t blob_1Length;
uint8_t * blob_2; size_t blob_2Length;
void IVaultNodeSetString (
uint64_t bit,
char ** pdst,
const char src[],
unsigned chars
) {
free(*pdst);
if (src && src[0])
*pdst = StrDupLen(src, chars);
else
*pdst = StrDupLen("", chars);
fieldFlags |= bit;
dirtyFlags |= bit;
}
void IVaultNodeSetString (
uint64_t bit,
wchar_t ** pdst,
const wchar_t src[],
unsigned chars
) {
free(*pdst);
if (src && src[0])
*pdst = StrDupLen(src, chars);
else
*pdst = StrDupLen(L"", chars);
fieldFlags |= bit;
dirtyFlags |= bit;
}
template <typename T>
inline void IVaultNodeSetValue (
uint64_t bit,
T * pdst,
const T & src
) {
*pdst = src;
fieldFlags |= bit;
dirtyFlags |= bit;
}
void IVaultNodeSetBlob (
uint64_t bit,
uint8_t ** pdst,
unsigned * pdstLen,
const uint8_t src[],
unsigned srcLen
) {
free(*pdst);
if (src) {
*pdst = (uint8_t*)malloc(srcLen);
memcpy(*pdst, src, srcLen);
*pdstLen = srcLen;
}
else {
*pdst = nil;
*pdstLen = 0;
}
fieldFlags |= bit;
dirtyFlags |= bit;
}
void DeallocNodeFields();
public:
NetVaultNode ();
~NetVaultNode ();
// Threaded apps: Must be called with node->critsect locked
unsigned Read_LCS (const uint8_t buffer[], unsigned bufsz, unsigned rwOpts); // returns number of bytes read
unsigned Write_LCS (ARRAY(uint8_t) * buffer, unsigned rwOpts); // returns number of bytes written
// Threaded apps: Must be called with node->critsect locked
uint32_t Read_LCS (const uint8_t buffer[], size_t bufsz, uint32_t rwOpts); // returns number of bytes read
uint32_t Write_LCS (ARRAY(uint8_t) * buffer, uint32_t rwOpts); // returns number of bytes written
bool Matches (const NetVaultNode * other);
void CopyFrom (const NetVaultNode * other, unsigned copyOpts);
// Threaded apps: Must be called with node->critsect locked
void SetNodeId (unsigned v);
void SetCreateTime (unsigned v);
void SetModifyTime (unsigned v);
void CopyFrom (const NetVaultNode * other, uint32_t copyOpts);
uint64_t GetFieldFlags () const { return fieldFlags; }
void ClearFieldFlags () { fieldFlags = 0; }
uint64_t GetDirtyFlags () const { return dirtyFlags; }
void SetDirtyFlags (uint64_t flags) { dirtyFlags |= flags; }
void ClearDirtyFlags (uint64_t flags) { dirtyFlags &= ~flags; }
// Threaded apps: Must be called with node->critsect locked
void SetNodeId (uint32_t v);
void SetNodeId_NoDirty (uint32_t v) { nodeId = v; }
void SetCreateTime (uint32_t v);
void SetModifyTime (uint32_t v);
void SetCreateAgeName (const wchar_t v[]);
void SetCreateAgeUuid (const plUUID& v);
void SetCreatorAcct (const plUUID& v);
void SetCreatorId (unsigned v);
void SetNodeType (unsigned v);
void SetInt32_1 (int v);
void SetInt32_2 (int v);
void SetInt32_3 (int v);
void SetInt32_4 (int v);
void SetUInt32_1 (unsigned v);
void SetUInt32_2 (unsigned v);
void SetUInt32_3 (unsigned v);
void SetUInt32_4 (unsigned v);
void SetUuid_1 (const plUUID& v);
void SetUuid_2 (const plUUID& v);
void SetUuid_3 (const plUUID& v);
void SetUuid_4 (const plUUID& v);
void SetCreateAgeUuid (const plUUID & v);
void SetCreatorAcct (const plUUID & v);
void SetCreatorId (uint32_t v);
void SetNodeType (uint32_t v);
void SetInt32_1 (int32_t v);
void SetInt32_2 (int32_t v);
void SetInt32_3 (int32_t v);
void SetInt32_4 (int32_t v);
void SetUInt32_1 (uint32_t v);
void SetUInt32_2 (uint32_t v);
void SetUInt32_3 (uint32_t v);
void SetUInt32_4 (uint32_t 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[]);
@ -289,154 +365,43 @@ struct NetVaultNode : AtomicRef {
void SetIString64_2 (const wchar_t v[]);
void SetText_1 (const wchar_t v[]);
void SetText_2 (const wchar_t v[]);
void SetBlob_1 (const uint8_t v[], unsigned len);
void SetBlob_2 (const uint8_t v[], unsigned len);
void SetText (uint64_t fieldFlag, const wchar_t v[]);
void SetBlob (uint64_t fieldFlag, const uint8_t v[], unsigned len);
// These are only here to aid macro expansions (naming case matches field flags)
inline unsigned GetNodeId () const { return nodeId; }
inline unsigned GetCreateTime () const { return createTime; }
inline unsigned GetModifyTime () const { return modifyTime; }
inline wchar_t * GetCreateAgeName () const { return createAgeName; }
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; }
inline int GetInt32_2 () const { return int32_2; }
inline int GetInt32_3 () const { return int32_3; }
inline int GetInt32_4 () const { return int32_4; }
inline unsigned GetUInt32_1 () const { return uint32_1; }
inline unsigned GetUInt32_2 () const { return uint32_2; }
inline unsigned GetUInt32_3 () const { return uint32_3; }
inline unsigned GetUInt32_4 () const { return uint32_4; }
inline 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; }
inline wchar_t * GetString64_4 () const { return string64_4; }
inline wchar_t * GetString64_5 () const { return string64_5; }
inline wchar_t * GetString64_6 () const { return string64_6; }
inline wchar_t * GetIString64_1 () const { return istring64_1; }
inline wchar_t * GetIString64_2 () const { return istring64_2; }
// no blob "getters"
};
//============================================================================
inline void IVaultNodeSetString (
uint64_t bit,
NetVaultNode * node,
char ** pdst,
const char src[],
unsigned chars
) {
free(*pdst);
if (src && src[0])
*pdst = StrDupLen(src, chars);
else
*pdst = StrDupLen("", chars);
node->fieldFlags |= bit;
node->dirtyFlags |= bit;
}
//============================================================================
inline void IVaultNodeSetString (
uint64_t bit,
NetVaultNode * node,
wchar_t ** pdst,
const wchar_t src[],
unsigned chars
) {
free(*pdst);
if (src && src[0])
*pdst = StrDupLen(src, chars);
else
*pdst = StrDupLen(L"", chars);
node->fieldFlags |= bit;
node->dirtyFlags |= bit;
}
//============================================================================
template <typename T>
inline void IVaultNodeSetValue (
uint64_t bit,
NetVaultNode * node,
T * pdst,
const T & src
) {
*pdst = src;
node->fieldFlags |= bit;
node->dirtyFlags |= bit;
}
//============================================================================
inline void IVaultNodeSetBlob (
uint64_t bit,
NetVaultNode * node,
uint8_t ** pdst,
unsigned * pdstLen,
const uint8_t src[],
unsigned srcLen
) {
free(*pdst);
if (src) {
*pdst = (uint8_t*)malloc(srcLen);
memcpy(*pdst, src, srcLen);
*pdstLen = srcLen;
}
else {
*pdst = nil;
*pdstLen = 0;
}
node->fieldFlags |= bit;
node->dirtyFlags |= bit;
}
//============================================================================
// NetVaultNodeFieldArray
//============================================================================
struct NetVaultNodeFieldArray {
enum EWhereCondition {
kAnd,
kOr
};
enum ESqlType {
kSqlInvalid,
kSqlInt32,
kSqlUInt32,
kSqlUuid,
kSqlString,
kSqlCLob,
KSqlBlob,
};
struct Field {
void * addr;
const wchar_t * name;
Field (void * addr, const wchar_t name[])
: addr(addr), name(name)
{ }
};
ARRAY(Field) fields;
NetVaultNode * node;
NetVaultNodeFieldArray (NetVaultNode * node);
~NetVaultNodeFieldArray ();
void * GetFieldAddress (uint64_t bit);
const wchar_t * GetFieldName (uint64_t bit);
// client must lock node's local critical section before calling these.
void GetFieldValueString_LCS (uint64_t bit, wchar_t * dst, unsigned dstChars);
void BuildWhereClause_LCS (EWhereCondition condition, wchar_t * dst, unsigned dstChars);
ESqlType GetSqlType_LCS (uint64_t bit);
void SetBlob_1 (const uint8_t v[], size_t len);
void SetBlob_2 (const uint8_t v[], size_t len);
uint32_t GetNodeId () const { return nodeId; }
uint32_t GetCreateTime () const { return createTime; }
uint32_t GetModifyTime () const { return modifyTime; }
const wchar_t * GetCreateAgeName () const { return createAgeName; }
plUUID GetCreateAgeUuid () const { return createAgeUuid; }
plUUID GetCreatorAcct () const { return creatorAcct; }
uint32_t GetCreatorId () const { return creatorId; }
uint32_t GetNodeType () const { return nodeType; }
int32_t GetInt32_1 () const { return int32_1; }
int32_t GetInt32_2 () const { return int32_2; }
int32_t GetInt32_3 () const { return int32_3; }
int32_t GetInt32_4 () const { return int32_4; }
uint32_t GetUInt32_1 () const { return uint32_1; }
uint32_t GetUInt32_2 () const { return uint32_2; }
uint32_t GetUInt32_3 () const { return uint32_3; }
uint32_t GetUInt32_4 () const { return uint32_4; }
plUUID GetUuid_1 () const { return uuid_1; }
plUUID GetUuid_2 () const { return uuid_2; }
plUUID GetUuid_3 () const { return uuid_3; }
plUUID GetUuid_4 () const { return uuid_4; }
const wchar_t * GetString64_1 () const { return string64_1; }
const wchar_t * GetString64_2 () const { return string64_2; }
const wchar_t * GetString64_3 () const { return string64_3; }
const wchar_t * GetString64_4 () const { return string64_4; }
const wchar_t * GetString64_5 () const { return string64_5; }
const wchar_t * GetString64_6 () const { return string64_6; }
const wchar_t * GetIString64_1 () const { return istring64_1; }
const wchar_t * GetIString64_2 () const { return istring64_2; }
const wchar_t * GetText_1 () const { return text_1; }
const wchar_t * GetText_2 () const { return text_2; }
const uint8_t * GetBlob_1 () const { return blob_1; }
size_t GetBlob_1Length () const { return blob_1Length; }
const uint8_t * GetBlob_2 () const { return blob_2; }
size_t GetBlob_2Length () const { return blob_2Length; }
};

34
Sources/Plasma/PubUtilLib/plAvatar/plAvatarClothing.cpp

@ -816,9 +816,9 @@ void plClothingOutfit::ReadFromVault()
for (unsigned i = 0; i < nodes.Count(); ++i) {
VaultSDLNode sdl(nodes[i]);
if (sdl.sdlDataLen) {
if (sdl.GetSDLDataLength()) {
hsRAMStream ram;
ram.Write(sdl.sdlDataLen, sdl.sdlData);
ram.Write(sdl.GetSDLDataLength(), sdl.GetSDLData());
ram.Rewind();
plString sdlRecName;
@ -947,33 +947,33 @@ void plClothingOutfit::WriteToVault(const ARRAY(plStateDataRecord*) & SDRs)
node->DecRef(); // REF: Work
}
}
// Delete any leftover nodes
{ for (unsigned i = 0; i < nodes.Count(); ++i) {
VaultDeleteNode(nodes[i]->nodeId);
for (unsigned i = 0; i < nodes.Count(); ++i) {
VaultDeleteNode(nodes[i]->GetNodeId());
nodes[i]->DecRef(); // REF: Array
}}
}
// Create actual new nodes from their templates
{ for (unsigned i = 0; i < templates.Count(); ++i) {
for (unsigned i = 0; i < templates.Count(); ++i) {
ENetError result;
if (RelVaultNode * actual = VaultCreateNodeAndWaitIncRef(templates[i], &result)) {
actuals.Add(actual);
}
templates[i]->DecRef(); // REF: Create
}}
}
// Add new nodes to outfit folder
{ for (unsigned i = 0; i < actuals.Count(); ++i) {
VaultAddChildNodeAndWait(rvn->nodeId, actuals[i]->nodeId, NetCommGetPlayer()->playerInt);
for (unsigned i = 0; i < actuals.Count(); ++i) {
VaultAddChildNodeAndWait(rvn->GetNodeId(), actuals[i]->GetNodeId(), NetCommGetPlayer()->playerInt);
actuals[i]->DecRef(); // REF: Create
}}
}
// Cleanup morph SDRs
{for (unsigned i = 0; i < morphs.Count(); ++i) {
for (unsigned i = 0; i < morphs.Count(); ++i) {
delete morphs[i];
}}
}
rvn->DecRef();
}
@ -1585,8 +1585,8 @@ void plClothingMgr::AddItemsToCloset(hsTArray<plClosetItem> &items)
ENetError result;
if (RelVaultNode * actual = VaultCreateNodeAndWaitIncRef(templates[i], &result)) {
VaultAddChildNodeAndWait(
rvn->nodeId,
actual->nodeId,
rvn->GetNodeId(),
actual->GetNodeId(),
NetCommGetPlayer()->playerInt
);
actual->DecRef(); // REF: Create

2
Sources/Plasma/PubUtilLib/plInputCore/plSceneInputInterface.cpp

@ -859,7 +859,7 @@ void plSceneInputInterface::ILinkOffereeToAge()
else if (RelVaultNode * linkNode = VaultGetOwnedAgeLinkIncRef(&info)) {
// We have the age in our AgesIOwnFolder. If its volatile, dump it for the new one.
VaultAgeLinkNode linkAcc(linkNode);
if (linkAcc.volat) {
if (linkAcc.GetVolatile()) {
if (VaultUnregisterOwnedAgeAndWait(link.GetAgeInfo())) {
plUUID guid = plUUID::Generate();
link.GetAgeInfo()->SetAgeInstanceGuid(&guid);

14
Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp

@ -795,10 +795,10 @@ void plNetLinkingMgr::IPostProcessLink( void )
RelVaultNode* info = VaultGetPlayerInfoNodeIncRef();
if (fldr && info)
if (!fldr->IsParentOf(info->nodeId, 1))
if (!fldr->IsParentOf(info->GetNodeId(), 1))
VaultAddChildNode(
fldr->nodeId,
info->nodeId,
fldr->GetNodeId(),
info->GetNodeId(),
NetCommGetPlayer()->playerInt,
nil,
nil
@ -822,10 +822,10 @@ void plNetLinkingMgr::IPostProcessLink( void )
RelVaultNode* info = VaultGetPlayerInfoNodeIncRef();
if (fldr && info)
if (!fldr->IsParentOf(info->nodeId, 1))
if (!fldr->IsParentOf(info->GetNodeId(), 1))
VaultAddChildNode(
fldr->nodeId,
info->nodeId,
fldr->GetNodeId(),
info->GetNodeId(),
NetCommGetPlayer()->playerInt,
nil,
nil
@ -981,7 +981,7 @@ uint8_t plNetLinkingMgr::IPreProcessLink(void)
else if (RelVaultNode* linkNode = VaultGetOwnedAgeLinkIncRef(&ageInfo)) {
// We have the age in our AgesIOwnFolder. If its volatile, dump it for the new one.
VaultAgeLinkNode linkAcc(linkNode);
if (linkAcc.volat) {
if (linkAcc.GetVolatile()) {
if (VaultUnregisterOwnedAgeAndWait(&ageInfo)) {
// Fill in fields for new age create.
if (!info->HasAgeUserDefinedName())

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

@ -5620,10 +5620,10 @@ unsigned NetCliAuthVaultNodeSave (
FNetCliAuthVaultNodeSaveCallback callback,
void * param
) {
ASSERTMSG(!(node->dirtyFlags & NetVaultNode::kNodeType), "Node type may not be changed");
ASSERTMSG(!(node->GetDirtyFlags() & NetVaultNode::kNodeType), "Node type may not be changed");
// Clear dirty bits of read-only fields before we write the node to the msg buffer
node->dirtyFlags &= ~(
node->ClearDirtyFlags(
NetVaultNode::kNodeId |
NetVaultNode::kNodeType |
NetVaultNode::kCreatorAcct |
@ -5631,15 +5631,15 @@ unsigned NetCliAuthVaultNodeSave (
NetVaultNode::kCreateTime
);
if (!node->dirtyFlags)
if (!node->GetDirtyFlags())
return 0;
if (!node->nodeId)
if (!node->GetNodeId())
return 0;
// force sending of the nodeType value, since the auth needs it.
// auth will clear the field before sending it on to the vault.
node->dirtyFlags |= NetVaultNode::kNodeType;
node->SetDirtyFlags(NetVaultNode::kNodeType);
// We're definitely saving this node, so assign a revisionId
node->revisionId = plUUID::Generate();
@ -5648,7 +5648,7 @@ unsigned NetCliAuthVaultNodeSave (
unsigned bytes = node->Write_LCS(&buffer, NetVaultNode::kRwDirtyOnly | NetVaultNode::kRwUpdateDirty);
VaultSaveNodeTrans * trans = new VaultSaveNodeTrans(
node->nodeId,
node->GetNodeId(),
node->revisionId,
buffer.Count(),
buffer.Ptr(),

413
Sources/Plasma/PubUtilLib/plVault/plVaultClientApi.cpp

File diff suppressed because it is too large Load Diff

530
Sources/Plasma/PubUtilLib/plVault/plVaultNodeAccess.cpp

@ -67,7 +67,7 @@ uint64_t GetNodeVolatileFields(NetVaultNode* node) {
unsigned index = 0;
while (volatileFieldList[index].nodeType != 0) {
if (node->nodeType == volatileFieldList[index].nodeType) {
if (node->GetNodeType() == volatileFieldList[index].nodeType) {
volatileFields |= volatileFieldList[index].volatileFields;
break;
}
@ -78,204 +78,6 @@ uint64_t GetNodeVolatileFields(NetVaultNode* node) {
return volatileFields;
}
/*****************************************************************************
*
* NetVaultNodeAccess
*
***/
//============================================================================
NetVaultNodeAccess::NetVaultNodeAccess (NetVaultNode * node)
: base(node)
, fieldFlags(node->fieldFlags)
, dirtyFlags(node->dirtyFlags)
{ }
/*****************************************************************************
*
* VaultPlayerNode
*
***/
//============================================================================
VaultPlayerNode::VaultPlayerNode (NetVaultNode * node)
: NetVaultNodeAccess(node)
, playerName(node->istring64_1)
, avatarShapeName(node->string64_1)
, disabled(node->int32_1)
, explorer(node->int32_2)
, onlineTime(node->uint32_1)
, accountUuid(node->uuid_1)
, inviteUuid(node->uuid_2)
{
}
//============================================================================
void VaultPlayerNode::SetPlayerName (const wchar_t v[]) {
IVaultNodeSetString(kPlayerName, base, &playerName, v, kMaxVaultNodeStringLength);
}
//============================================================================
void VaultPlayerNode::SetAvatarShapeName (const wchar_t v[]) {
IVaultNodeSetString(kAvatarShapeName, base, &avatarShapeName, v, kMaxVaultNodeStringLength);
}
//============================================================================
void VaultPlayerNode::SetDisabled (int v) {
IVaultNodeSetValue(kDisabled, base, &disabled, v);
}
//============================================================================
void VaultPlayerNode::SetOnlineTime (unsigned v) {
IVaultNodeSetValue(kOnlineTime, base, &onlineTime, v);
}
//============================================================================
void VaultPlayerNode::SetAccountUuid (const plUUID& v) {
IVaultNodeSetValue(kAccountUuid, base, &accountUuid, v);
}
//============================================================================
void VaultPlayerNode::SetInviteUuid (const plUUID& v) {
IVaultNodeSetValue(kInviteUuid, base, &inviteUuid, v);
}
//============================================================================
void VaultPlayerNode::SetExplorer (int v) {
IVaultNodeSetValue(kExplorer, base, &explorer, v);
}
/*****************************************************************************
*
* VaultPlayerInfoNode
*
***/
//============================================================================
VaultPlayerInfoNode::VaultPlayerInfoNode (NetVaultNode * node)
: NetVaultNodeAccess(node)
, playerId(node->uint32_1)
, playerName(node->istring64_1)
, ageInstName(node->string64_1)
, ageInstUuid(node->uuid_1)
, online(node->int32_1)
, ccrLevel(node->int32_2)
{
}
//============================================================================
void VaultPlayerInfoNode::SetPlayerId (unsigned v) {
IVaultNodeSetValue(kPlayerId, base, &playerId, v);
}
//============================================================================
void VaultPlayerInfoNode::SetPlayerName (const wchar_t v[]) {
IVaultNodeSetString(kPlayerName, base, &playerName, v, kMaxVaultNodeStringLength);
}
//============================================================================
void VaultPlayerInfoNode::SetAgeInstName (const wchar_t v[]) {
IVaultNodeSetString(kAgeInstName, base, &ageInstName, v, kMaxVaultNodeStringLength);
}
//============================================================================
void VaultPlayerInfoNode::SetAgeInstUuid (const plUUID& v) {
IVaultNodeSetValue(kAgeInstUuid, base, &ageInstUuid, v);
}
//============================================================================
void VaultPlayerInfoNode::SetOnline (int v) {
IVaultNodeSetValue(kOnline, base, &online, v);
}
//============================================================================
void VaultPlayerInfoNode::SetCCRLevel (int v) {
IVaultNodeSetValue(kCCRLevel, base, &ccrLevel, v);
}
/*****************************************************************************
*
* VaultFolderNode
*
***/
//============================================================================
VaultFolderNode::VaultFolderNode (NetVaultNode * node)
: NetVaultNodeAccess(node)
, folderType(node->int32_1)
, folderName(node->string64_1)
{
}
//============================================================================
void VaultFolderNode::SetFolderName (const wchar_t v[]) {
IVaultNodeSetString(kFolderName, base, &folderName, v, kMaxVaultNodeStringLength);
}
//============================================================================
void VaultFolderNode::SetFolderType (int v) {
IVaultNodeSetValue(kFolderType, base, &folderType, v);
}
/*****************************************************************************
*
* VaultPlayerInfoListNode
*
***/
//============================================================================
VaultPlayerInfoListNode::VaultPlayerInfoListNode (NetVaultNode * node)
: VaultFolderNode(node)
{
}
/*****************************************************************************
*
* VaultAgeInfoListNode
*
***/
//============================================================================
VaultAgeInfoListNode::VaultAgeInfoListNode (NetVaultNode * node)
: VaultFolderNode(node)
{
}
/*****************************************************************************
*
* VaultChronicleNode
*
***/
//============================================================================
VaultChronicleNode::VaultChronicleNode (NetVaultNode * node)
: NetVaultNodeAccess(node)
, entryType(node->int32_1)
, entryName(node->string64_1)
, entryValue(node->text_1)
{
}
//============================================================================
void VaultChronicleNode::SetEntryType (int v) {
IVaultNodeSetValue(kEntryType, base, &entryType, v);
}
//============================================================================
void VaultChronicleNode::SetEntryName (const wchar_t v[]) {
IVaultNodeSetString(kEntryName, base, &entryName, v, kMaxVaultNodeStringLength);
}
//============================================================================
void VaultChronicleNode::SetEntryValue (const wchar_t v[]) {
IVaultNodeSetString(kEntryValue, base, &entryValue, v, (unsigned)-1);
}
/*****************************************************************************
*
@ -283,36 +85,6 @@ void VaultChronicleNode::SetEntryValue (const wchar_t v[]) {
*
***/
//============================================================================
VaultTextNoteNode::VaultTextNoteNode (NetVaultNode * node)
: NetVaultNodeAccess(node)
, noteType(node->int32_1)
, noteSubType(node->int32_2)
, noteTitle(node->string64_1)
, noteText(node->text_1)
{
}
//============================================================================
void VaultTextNoteNode::SetNoteType (int v) {
IVaultNodeSetValue(kNoteType, base, &noteType, v);
}
//============================================================================
void VaultTextNoteNode::SetNoteSubType (int v) {
IVaultNodeSetValue(kNoteSubType, base, &noteSubType, v);
}
//============================================================================
void VaultTextNoteNode::SetNoteTitle (const wchar_t v[]) {
IVaultNodeSetString(kNoteTitle, base, &noteTitle, v, kMaxVaultNodeStringLength);
}
//============================================================================
void VaultTextNoteNode::SetNoteText (const wchar_t v[]) {
IVaultNodeSetString(kNoteText, base, &noteText, v, (unsigned)-1);
}
//============================================================================
enum EAgeInfoFields {
kAgeFilename,
@ -415,7 +187,7 @@ void VaultTextNoteNode::SetVisitInfo (const plAgeInfoStruct & info) {
bool VaultTextNoteNode::GetVisitInfo (plAgeInfoStruct * info) {
wchar_t * mem;
const wchar_t * str = mem = StrDup(noteText);
const wchar_t * str = mem = StrDup(GetNoteText());
for (unsigned i = 0; i < kNumAgeInfoFields; ++i) {
@ -487,9 +259,9 @@ bool VaultTextNoteNode::GetVisitInfo (plAgeInfoStruct * info) {
break;
DEFAULT_FATAL(i);
}
}
}
free(mem);
return true;
}
@ -501,42 +273,22 @@ bool VaultTextNoteNode::GetVisitInfo (plAgeInfoStruct * info) {
* VaultSDLNode
*
***/
//============================================================================
VaultSDLNode::VaultSDLNode (NetVaultNode * node)
: NetVaultNodeAccess(node)
, sdlIdent(node->int32_1)
, sdlName(node->string64_1)
, sdlData(node->blob_1)
, sdlDataLen(node->blob_1Length)
{
}
//============================================================================
void VaultSDLNode::SetSdlIdent (int v) {
IVaultNodeSetValue(kSDLIdent, base, &sdlIdent, v);
}
//============================================================================
void VaultSDLNode::SetSdlName (const wchar_t v[]) {
IVaultNodeSetString(kSDLName, base, &sdlName, v, kMaxVaultNodeStringLength);
}
//============================================================================
#ifdef CLIENT
bool VaultSDLNode::GetStateDataRecord (plStateDataRecord * rec, unsigned readOptions) {
if (!sdlDataLen || !sdlData)
if (!GetSDLDataLength() || !GetSDLData())
return false;
hsRAMStream ram;
ram.Write(sdlDataLen, sdlData);
ram.Write(GetSDLDataLength(), GetSDLData());
ram.Rewind();
plString sdlRecName;
int sdlRecVersion;
if (!plStateDataRecord::ReadStreamHeader(&ram, &sdlRecName, &sdlRecVersion))
return false;
rec->SetDescriptor(sdlRecName, sdlRecVersion);
// Note: Setting from default here results in a bug causing age SDL to
@ -562,15 +314,13 @@ void VaultSDLNode::SetStateDataRecord (const plStateDataRecord * rec, unsigned w
rec->WriteStreamHeader(&ram);
rec->Write(&ram, 0, writeOptions);
ram.Rewind();
unsigned bytes = ram.GetEOF();
uint8_t * buf = nil;
buf = (uint8_t *)malloc(bytes);
ram.CopyToMem(buf);
IVaultNodeSetBlob(kSDLData, base, &sdlData, &sdlDataLen, buf, bytes);
ram.CopyToMem(buf);
SetSDLData(buf, bytes);
free(buf);
}
#endif // def CLIENT
@ -585,7 +335,7 @@ void VaultSDLNode::InitStateDataRecord (const wchar_t sdlRecName[], unsigned wri
if (exists)
return;
}
char aStr[MAX_PATH];
StrToAnsi(aStr, sdlRecName, arrsize(aStr));
if (plStateDescriptor * des = plSDLMgr::GetInstance()->FindDescriptor(aStr, plSDL::kLatestVersion)) {
@ -603,31 +353,6 @@ void VaultSDLNode::InitStateDataRecord (const wchar_t sdlRecName[], unsigned wri
*
***/
//============================================================================
VaultImageNode::VaultImageNode (NetVaultNode * node)
: NetVaultNodeAccess(node)
, title(node->string64_1)
, imgType(node->int32_1)
, imgData(node->blob_1)
, imgDataLen(node->blob_1Length)
{
}
//============================================================================
void VaultImageNode::SetImageTitle (const wchar_t v[]) {
IVaultNodeSetString(kImageTitle, base, &title, v, kMaxVaultNodeStringLength);
}
//============================================================================
void VaultImageNode::SetImageType (int v) {
IVaultNodeSetValue(kImageType, base, &imgType, v);
}
//============================================================================
void VaultImageNode::SetImageData (const uint8_t buffer[], unsigned bytes) {
IVaultNodeSetBlob(kImageData, base, &imgData, &imgDataLen, buffer, bytes);
}
//============================================================================
#ifdef CLIENT
void VaultImageNode::StuffImage (plMipmap * src, int dstType) {
@ -647,14 +372,14 @@ void VaultImageNode::StuffImage (plMipmap * src, int dstType) {
}
if (compressSuccess) {
unsigned bytes = ramStream.GetEOF();
unsigned bytes = ramStream.GetEOF();
uint8_t * buffer = (uint8_t *)malloc(bytes);
ramStream.CopyToMem(buffer);
IVaultNodeSetBlob(kImageData, base, &imgData, &imgDataLen, buffer, bytes);
SetImageData(buffer, bytes);
SetImageType(dstType);
free(buffer);
} else {
IVaultNodeSetBlob(kImageData, base, &imgData, &imgDataLen, nil, 0);
SetImageData(nil, 0);
SetImageType(kNone);
}
}
@ -664,10 +389,10 @@ void VaultImageNode::StuffImage (plMipmap * src, int dstType) {
#ifdef CLIENT
bool VaultImageNode::ExtractImage (plMipmap ** dst) {
hsRAMStream ramStream;
ramStream.Write(imgDataLen, imgData);
ramStream.Write(GetImageDataLength(), GetImageData());
ramStream.Rewind();
switch (imgType) {
switch (GetImageType()) {
case kJPEG:
(*dst) = plJPEG::Instance().ReadFromStream(&ramStream);
break;
@ -707,30 +432,10 @@ struct MatchesSpawnPointName
};
#endif
//============================================================================
VaultAgeLinkNode::VaultAgeLinkNode (NetVaultNode * node)
: NetVaultNodeAccess(node)
, unlocked(node->int32_1)
, volat(node->int32_2)
, spawnPoints(node->blob_1)
, spawnPointsLen(node->blob_1Length)
{
}
//============================================================================
void VaultAgeLinkNode::SetUnlocked (int v) {
IVaultNodeSetValue(kUnlocked, base, &unlocked, v);
}
//============================================================================
void VaultAgeLinkNode::SetVolatile (int v) {
IVaultNodeSetValue(kVolatile, base, &volat, v);
}
//============================================================================
#ifdef CLIENT
bool VaultAgeLinkNode::CopyTo (plAgeLinkStruct * link) {
if (RelVaultNode * me = VaultGetNodeIncRef(base->nodeId)) {
if (RelVaultNode * me = VaultGetNodeIncRef(base->GetNodeId())) {
if (RelVaultNode * info = me->GetChildNodeIncRef(plVault::kNodeType_AgeInfo, 1)) {
VaultAgeInfoNode access(info);
access.CopyTo(link->GetAgeInfo());
@ -801,7 +506,7 @@ bool VaultAgeLinkNode::HasSpawnPoint (const plSpawnPointInfo & point) const {
#ifdef CLIENT
void VaultAgeLinkNode::GetSpawnPoints (plSpawnPointVec * out) const {
plString str = plString::FromUtf8(reinterpret_cast<const char*>(spawnPoints), spawnPointsLen);
plString str = plString::FromUtf8(reinterpret_cast<const char*>(GetSpawnPoints()), GetSpawnPointsLength());
std::vector<plString> izer = str.Tokenize(";");
for (auto token1 = izer.begin(); token1 != izer.end(); ++token1)
{
@ -830,132 +535,17 @@ void VaultAgeLinkNode::SetSpawnPoints (const plSpawnPointVec & in) {
<< in[i].fSpawnPt << ":"
<< in[i].fCameraStack << ";";
}
IVaultNodeSetBlob(
kSpawnPoints,
base,
&spawnPoints,
&spawnPointsLen,
(const uint8_t *)ss.GetString().c_str(),
ss.GetLength()
);
plString blob = ss.GetString();
SetSpawnPoints(reinterpret_cast<const uint8_t *>(blob.c_str()), blob.GetSize());
}
#endif
/*****************************************************************************
*
* VaultAgeNode
*
***/
//============================================================================
VaultAgeNode::VaultAgeNode (NetVaultNode * node)
: NetVaultNodeAccess(node)
, ageInstUuid(node->uuid_1)
, parentAgeInstUuid(node->uuid_2)
, ageName(node->string64_1)
{
}
//============================================================================
void VaultAgeNode::SetAgeInstGuid (const plUUID& v) {
IVaultNodeSetValue(kAgeInstanceGuid, base, &ageInstUuid, v);
}
//============================================================================
void VaultAgeNode::SetParentAgeInstGuid (const plUUID& v) {
IVaultNodeSetValue(kParentAgeInstanceGuid, base, &parentAgeInstUuid, v);
}
//============================================================================
void VaultAgeNode::SetAgeName (const wchar_t v[]) {
IVaultNodeSetString(kAgeName, base, &ageName, v, kMaxVaultNodeStringLength);
}
/*****************************************************************************
*
* VaultAgeInfoNode
*
***/
//============================================================================
VaultAgeInfoNode::VaultAgeInfoNode (NetVaultNode * node)
: NetVaultNodeAccess(node)
, ageFilename(node->string64_2)
, ageInstName(node->string64_3)
, ageUserDefinedName(node->string64_4)
, ageInstUuid(node->uuid_1)
, parentAgeInstUuid(node->uuid_2)
, ageSequenceNumber(node->int32_1)
, ageIsPublic(node->int32_2)
, ageLanguage(node->int32_3)
, ageId(node->uint32_1)
, ageCzarId(node->uint32_2)
, ageInfoFlags(node->uint32_3)
, ageDescription(node->text_1)
{
}
//============================================================================
void VaultAgeInfoNode::SetAgeFilename (const wchar_t v[]) {
IVaultNodeSetString(kAgeFilename, base, &ageFilename, v, kMaxVaultNodeStringLength);
}
//============================================================================
void VaultAgeInfoNode::SetAgeInstName (const wchar_t v[]) {
IVaultNodeSetString(kAgeInstanceName, base, &ageInstName, v, kMaxVaultNodeStringLength);
}
//============================================================================
void VaultAgeInfoNode::SetAgeUserDefinedName (const wchar_t v[]) {
IVaultNodeSetString(kAgeUserDefinedName, base, &ageUserDefinedName, v, kMaxVaultNodeStringLength);
}
//============================================================================
void VaultAgeInfoNode::SetAgeInstGuid (const plUUID& v) {
IVaultNodeSetValue(kAgeInstanceGuid, base, &ageInstUuid, v);
}
//============================================================================
void VaultAgeInfoNode::SetParentAgeInstGuid (const plUUID& v) {
IVaultNodeSetValue(kParentAgeInstanceGuid, base, &parentAgeInstUuid, v);
}
//============================================================================
void VaultAgeInfoNode::SetAgeSequenceNumber (int v) {
IVaultNodeSetValue(kAgeSequenceNumber, base, &ageSequenceNumber, v);
}
//============================================================================
void VaultAgeInfoNode::_SetAgeIsPublic (int v) {
IVaultNodeSetValue(kIsPublic, base, &ageIsPublic, v);
}
//============================================================================
void VaultAgeInfoNode::SetAgeLanguage (int v) {
IVaultNodeSetValue(kAgeLanguage, base, &ageLanguage, v);
}
//============================================================================
void VaultAgeInfoNode::SetAgeId (unsigned v) {
IVaultNodeSetValue(kAgeId, base, &ageId, v);
}
//============================================================================
void VaultAgeInfoNode::SetAgeCzarId (unsigned v) {
IVaultNodeSetValue(kAgeCzarId, base, &ageCzarId, v);
}
//============================================================================
void VaultAgeInfoNode::SetAgeInfoFlags (unsigned v) {
IVaultNodeSetValue(kAgeInfoFlags, base, &ageInfoFlags, v);
}
//============================================================================
void VaultAgeInfoNode::SetAgeDescription (const wchar_t v[]) {
IVaultNodeSetString(kAgeDescription, base, &ageDescription, v, (unsigned)-1);
}
//============================================================================
#ifdef CLIENT
const class plUnifiedTime * VaultAgeInfoNode::GetAgeTime () const {
@ -978,13 +568,13 @@ void VaultAgeInfoNode::CopyFrom (const plAgeInfoStruct * info) {
SetAgeFilename(nil);
}
// age instance name
// age instance name
if (info->HasAgeInstanceName()) {
StrToUnicode(str, info->GetAgeInstanceName(), arrsize(str));
SetAgeInstName(str);
SetAgeInstanceName(str);
}
else {
SetAgeInstName(nil);
SetAgeInstanceName(nil);
}
// age user-defined name
@ -1010,9 +600,9 @@ void VaultAgeInfoNode::CopyFrom (const plAgeInfoStruct * info) {
SetAgeSequenceNumber(info->GetAgeSequenceNumber());
// age instance guid
SetAgeInstGuid(*info->GetAgeInstanceGuid());
SetAgeInstanceGuid(*info->GetAgeInstanceGuid());
// age language
// age language
SetAgeLanguage(info->GetAgeLanguage());
}
#endif // def CLIENT
@ -1022,73 +612,29 @@ void VaultAgeInfoNode::CopyFrom (const plAgeInfoStruct * info) {
void VaultAgeInfoNode::CopyTo (plAgeInfoStruct * info) const {
char str[MAX_PATH];
// age filename
StrToAnsi(str, ageFilename, arrsize(str));
// age filename
StrToAnsi(str, GetAgeFilename(), arrsize(str));
info->SetAgeFilename(str);
// age instance name
StrToAnsi(str, ageInstName, arrsize(str));
StrToAnsi(str, GetAgeInstanceName(), arrsize(str));
info->SetAgeInstanceName(str);
// age user-defined name
StrToAnsi(str, ageUserDefinedName, arrsize(str));
StrToAnsi(str, GetAgeUserDefinedName(), arrsize(str));
info->SetAgeUserDefinedName(str);
// age description
// TODO
// age sequence number
info->SetAgeSequenceNumber(ageSequenceNumber);
info->SetAgeSequenceNumber(GetAgeSequenceNumber());
// age instance guid
plUUID uuid(ageInstUuid);
plUUID uuid(GetAgeInstanceGuid());
info->SetAgeInstanceGuid(&uuid);
// age language
info->SetAgeLanguage(ageLanguage);
info->SetAgeLanguage(GetAgeLanguage());
}
#endif // def CLIENT
/*****************************************************************************
*
* VaultSystemNode
*
***/
//============================================================================
VaultSystemNode::VaultSystemNode (NetVaultNode * node)
: NetVaultNodeAccess(node)
, ccrStatus(node->int32_1)
{
}
//============================================================================
void VaultSystemNode::SetCCRStatus (int v) {
IVaultNodeSetValue(kCCRStatus, base, &ccrStatus, v);
}
/*****************************************************************************
*
* VaultMarkerGameNode
*
***/
//============================================================================
VaultMarkerGameNode::VaultMarkerGameNode (NetVaultNode * node)
: NetVaultNodeAccess(node)
, gameName(node->text_1)
, gameGuid(node->uuid_1)
{
}
//============================================================================
void VaultMarkerGameNode::SetGameName (const wchar_t v[]) {
IVaultNodeSetString(kGameName, base, &gameName, v, (unsigned)-1);
}
//============================================================================
void VaultMarkerGameNode::SetGameGuid (const plUUID& v) {
IVaultNodeSetValue(kGameGuid, base, &gameGuid, v);
}

345
Sources/Plasma/PubUtilLib/plVault/plVaultNodeAccess.h

@ -74,49 +74,38 @@ uint64_t GetNodeVolatileFields(NetVaultNode* node);
//============================================================================
struct NetVaultNodeAccess {
NetVaultNode * base;
uint64_t & fieldFlags;
uint64_t & dirtyFlags;
NetVaultNodeAccess (NetVaultNode * node);
NetVaultNodeAccess (const NetVaultNodeAccess &); // not implemented
const NetVaultNodeAccess & operator= (const NetVaultNodeAccess &); // not implemented
NetVaultNodeAccess (NetVaultNode * node) : base(node) { }
private:
NetVaultNodeAccess (const NetVaultNodeAccess &) { }
const NetVaultNodeAccess & operator= (const NetVaultNodeAccess &) { }
};
#define VNODE_ACCESSOR(type, name, basename) \
static const uint64_t k##name = NetVaultNode::k##basename; \
type Get##name () const { return base->Get##basename(); } \
void Set##name (type v) { base->Set##basename(v); }
#define VNODE_BLOB(name, basename) \
static const uint64_t k##name = NetVaultNode::k##basename; \
const uint8_t * Get##name () const { return base->Get##basename(); } \
size_t Get##name##Length () const { return base->Get##basename##Length(); } \
void Set##name (const uint8_t data[], size_t length) { base->Set##basename(data, length); }
//============================================================================
// VaultPlayerNode
//============================================================================
struct VaultPlayerNode : NetVaultNodeAccess {
static const uint64_t kPlayerName = NetVaultNode::kIString64_1;
static const uint64_t kAvatarShapeName = NetVaultNode::kString64_1;
static const uint64_t kDisabled = NetVaultNode::kInt32_1;
static const uint64_t kExplorer = NetVaultNode::kInt32_2; // explorer = 1, visitor = 0
static const uint64_t kOnlineTime = NetVaultNode::kUInt32_1;
static const uint64_t kAccountUuid = NetVaultNode::kUuid_1;
static const uint64_t kInviteUuid = NetVaultNode::kUuid_2;
// Treat these as read-only or node flag fields will become invalid
// Threaded apps: Must be accessed with node->critsect locked
wchar_t *& playerName;
wchar_t *& avatarShapeName;
int & disabled;
unsigned & onlineTime;
plUUID& accountUuid;
plUUID& inviteUuid;
int & explorer;
VaultPlayerNode (NetVaultNode * node);
VaultPlayerNode (const VaultPlayerNode &); // not implemented
const VaultPlayerNode & operator= (const VaultPlayerNode &); // not implemented
// Threaded apps: Must be called with node->critsect locked
void SetPlayerName (const wchar_t v[]);
void SetAvatarShapeName (const wchar_t v[]);
void SetDisabled (int v);
void SetOnlineTime (unsigned v);
void SetAccountUuid (const plUUID& v);
void SetInviteUuid (const plUUID& v);
void SetExplorer (int v);
VNODE_ACCESSOR(const wchar_t *, PlayerName, IString64_1);
VNODE_ACCESSOR(const wchar_t *, AvatarShapeName, String64_1);
VNODE_ACCESSOR(int32_t, Disabled, Int32_1);
VNODE_ACCESSOR(int32_t, Explorer, Int32_2); // explorer = 1, visitor = 0
VNODE_ACCESSOR(uint32_t, OnlineTime, UInt32_1);
VNODE_ACCESSOR(plUUID, AccountUuid, Uuid_1);
VNODE_ACCESSOR(plUUID, InviteUuid, Uuid_2);
VaultPlayerNode (NetVaultNode * node) : NetVaultNodeAccess(node) { }
};
@ -124,33 +113,14 @@ struct VaultPlayerNode : NetVaultNodeAccess {
// VaultPlayerInfoNode
//============================================================================
struct VaultPlayerInfoNode : NetVaultNodeAccess {
static const uint64_t kPlayerId = NetVaultNode::kUInt32_1;
static const uint64_t kPlayerName = NetVaultNode::kIString64_1;
static const uint64_t kAgeInstName = NetVaultNode::kString64_1; // name of age player is currently in
static const uint64_t kAgeInstUuid = NetVaultNode::kUuid_1; // guid of age player is currently in
static const uint64_t kOnline = NetVaultNode::kInt32_1; // whether or not player is online
static const uint64_t kCCRLevel = NetVaultNode::kInt32_2;
// Treat these as read-only or node flag fields will become invalid
// Threaded apps: Must be accessed with node->critsect locked
unsigned & playerId;
wchar_t *& playerName;
wchar_t *& ageInstName;
plUUID& ageInstUuid;
int & online;
int & ccrLevel;
VaultPlayerInfoNode (NetVaultNode * node);
VaultPlayerInfoNode (const VaultPlayerInfoNode &); // not implemented
const VaultPlayerInfoNode & operator= (const VaultPlayerInfoNode &); // not implemented
// Threaded apps: Must be called with node->critsect locked
void SetPlayerId (unsigned v);
void SetPlayerName (const wchar_t v[]);
void SetAgeInstName (const wchar_t v[]);
void SetAgeInstUuid (const plUUID& v);
void SetOnline (int v);
void SetCCRLevel (int v);
VNODE_ACCESSOR(uint32_t, PlayerId, UInt32_1);
VNODE_ACCESSOR(const wchar_t *, PlayerName, IString64_1);
VNODE_ACCESSOR(const wchar_t *, AgeInstName, String64_1); // name of age player is currently in
VNODE_ACCESSOR(plUUID, AgeInstUuid, Uuid_1); // guid of age player is currently in
VNODE_ACCESSOR(int32_t, Online, Int32_1); // whether or not player is online
VNODE_ACCESSOR(int32_t, CCRLevel, Int32_2);
VaultPlayerInfoNode (NetVaultNode * node) : NetVaultNodeAccess(node) { }
};
@ -158,21 +128,10 @@ struct VaultPlayerInfoNode : NetVaultNodeAccess {
// VaultFolderNode
//============================================================================
struct VaultFolderNode : NetVaultNodeAccess {
static const uint64_t kFolderType = NetVaultNode::kInt32_1;
static const uint64_t kFolderName = NetVaultNode::kString64_1;
// Treat these as read-only or node flag fields will become invalid
// Threaded apps: Must be accessed with node->critsect locked
int & folderType;
wchar_t *& folderName;
VaultFolderNode (NetVaultNode * node);
VaultFolderNode (const VaultFolderNode &); // not implemented
const VaultFolderNode & operator= (const VaultFolderNode &); // not implemented
// Threaded apps: Must be called with node->critsect locked
void SetFolderName (const wchar_t v[]);
void SetFolderType (int v);
VNODE_ACCESSOR(int32_t, FolderType, Int32_1);
VNODE_ACCESSOR(const wchar_t *, FolderName, String64_1);
VaultFolderNode (NetVaultNode * node) : NetVaultNodeAccess(node) { }
};
@ -180,44 +139,25 @@ struct VaultFolderNode : NetVaultNodeAccess {
// VaultPlayerInfoListNode
//============================================================================
struct VaultPlayerInfoListNode : VaultFolderNode {
VaultPlayerInfoListNode (NetVaultNode * node);
VaultPlayerInfoListNode (const VaultPlayerInfoListNode &); // not implemented
const VaultPlayerInfoListNode & operator= (const VaultPlayerInfoListNode &); // not implemented
VaultPlayerInfoListNode (NetVaultNode * node) : VaultFolderNode(node) { }
};
//============================================================================
// VaultAgeInfoListNode
//============================================================================
struct VaultAgeInfoListNode : VaultFolderNode {
VaultAgeInfoListNode (NetVaultNode * node);
VaultAgeInfoListNode (const VaultAgeInfoListNode &); // not implemented
const VaultAgeInfoListNode & operator= (const VaultAgeInfoListNode &); // not implemented
VaultAgeInfoListNode (NetVaultNode * node) : VaultFolderNode(node) { }
};
//============================================================================
// VaultChronicleNode
//============================================================================
struct VaultChronicleNode : NetVaultNodeAccess {
static const uint64_t kEntryType = NetVaultNode::kInt32_1;
static const uint64_t kEntryName = NetVaultNode::kString64_1;
static const uint64_t kEntryValue = NetVaultNode::kText_1;
// Treat these as read-only or node flag fields will become invalid
// Threaded apps: Must be accessed with node->critsect locked
int & entryType;
wchar_t *& entryName;
wchar_t *& entryValue;
VaultChronicleNode (NetVaultNode * node);
VaultChronicleNode (const VaultChronicleNode &); // not implemented
const VaultChronicleNode & operator= (const VaultChronicleNode &); // not implemented
// Threaded apps: Must be called with node->critsect locked
void SetEntryType (int v);
void SetEntryName (const wchar_t v[]);
void SetEntryValue (const wchar_t v[]);
VNODE_ACCESSOR(int32_t, EntryType, Int32_1);
VNODE_ACCESSOR(const wchar_t *, EntryName, String64_1);
VNODE_ACCESSOR(const wchar_t *, EntryValue, Text_1);
VaultChronicleNode (NetVaultNode * node) : NetVaultNodeAccess(node) { }
};
@ -225,21 +165,11 @@ struct VaultChronicleNode : NetVaultNodeAccess {
// VaultSDLNode
//============================================================================
struct VaultSDLNode : NetVaultNodeAccess {
static const uint64_t kSDLName = NetVaultNode::kString64_1;
static const uint64_t kSDLIdent = NetVaultNode::kInt32_1;
static const uint64_t kSDLData = NetVaultNode::kBlob_1;
int & sdlIdent;
wchar_t *& sdlName;
uint8_t *& sdlData;
unsigned & sdlDataLen;
VaultSDLNode (NetVaultNode * node);
VaultSDLNode (const VaultSDLNode &); // not implemented
const VaultSDLNode & operator= (const VaultSDLNode &); // not implemented
void SetSdlIdent (int v);
void SetSdlName (const wchar_t v[]);
VNODE_ACCESSOR(const wchar_t *, SDLName, String64_1);
VNODE_ACCESSOR(int32_t, SDLIdent, Int32_1);
VNODE_BLOB ( SDLData, Blob_1);
VaultSDLNode (NetVaultNode * node) : NetVaultNodeAccess(node) { }
#ifdef CLIENT
bool GetStateDataRecord (class plStateDataRecord * out, unsigned readOptions = 0);
@ -252,21 +182,11 @@ struct VaultSDLNode : NetVaultNodeAccess {
// VaultAgeLinkNode
//============================================================================
struct VaultAgeLinkNode : NetVaultNodeAccess {
static const uint64_t kUnlocked = NetVaultNode::kInt32_1;
static const uint64_t kVolatile = NetVaultNode::kInt32_2;
static const uint64_t kSpawnPoints = NetVaultNode::kBlob_1;
int & unlocked;
int & volat;
uint8_t *& spawnPoints;
unsigned & spawnPointsLen;
VaultAgeLinkNode (NetVaultNode * node);
VaultAgeLinkNode (const VaultAgeLinkNode &); // not implemented
const VaultAgeLinkNode & operator= (const VaultAgeLinkNode &); // not implemented
void SetUnlocked (int v);
void SetVolatile (int v);
VNODE_ACCESSOR(int32_t, Unlocked, Int32_1);
VNODE_ACCESSOR(int32_t, Volatile, Int32_2);
VNODE_BLOB ( SpawnPoints, Blob_1);
VaultAgeLinkNode (NetVaultNode * node) : NetVaultNodeAccess(node) { }
#ifdef CLIENT
bool CopyTo (plAgeLinkStruct * link);
@ -283,26 +203,14 @@ struct VaultAgeLinkNode : NetVaultNodeAccess {
// VaultImageNode
//============================================================================
struct VaultImageNode : NetVaultNodeAccess {
enum ImageTypes { kNone=0, kJPEG=1, kPNG=2 };
static const uint64_t kImageType = NetVaultNode::kInt32_1;
static const uint64_t kImageTitle = NetVaultNode::kString64_1;
static const uint64_t kImageData = NetVaultNode::kBlob_1;
wchar_t *& title;
int & imgType;
uint8_t *& imgData;
unsigned & imgDataLen;
VaultImageNode (NetVaultNode * node);
VaultImageNode (const VaultImageNode &); // not implemented
const VaultImageNode & operator= (const VaultImageNode &); // not implemented
void SetImageTitle (const wchar_t v[]);
void SetImageType (int v);
void SetImageData (const uint8_t buffer[], unsigned bytes);
VNODE_ACCESSOR(int32_t, ImageType, Int32_1);
VNODE_ACCESSOR(const wchar_t *, ImageTitle, String64_1);
VNODE_BLOB ( ImageData, Blob_1);
VaultImageNode (NetVaultNode * node) : NetVaultNodeAccess(node) { }
#ifdef CLIENT
void StuffImage (class plMipmap * src, int dstType=kJPEG);
bool ExtractImage (class plMipmap ** dst);
@ -316,9 +224,7 @@ struct VaultImageNode : NetVaultNodeAccess {
struct VaultCliImageNode : VaultImageNode {
class plMipmap * fMipmap;
VaultCliImageNode (NetVaultNode * node);
VaultCliImageNode (const VaultCliImageNode &); // not implemented
const VaultCliImageNode & operator= (const VaultCliImageNode &); // not implemented
VaultCliImageNode (NetVaultNode * node) : VaultImageNode(node) { }
};
#endif // def CLIENT
@ -326,27 +232,14 @@ struct VaultCliImageNode : VaultImageNode {
// VaultTextNoteNode
//============================================================================
struct VaultTextNoteNode : NetVaultNodeAccess {
VNODE_ACCESSOR(int32_t, NoteType, Int32_1);
VNODE_ACCESSOR(int32_t, NoteSubType, Int32_2);
VNODE_ACCESSOR(const wchar_t *, NoteTitle, String64_1);
VNODE_ACCESSOR(const wchar_t *, NoteText, Text_1);
VaultTextNoteNode (NetVaultNode * node) : NetVaultNodeAccess(node) { }
static const uint64_t kNoteType = NetVaultNode::kInt32_1;
static const uint64_t kNoteSubType = NetVaultNode::kInt32_2;
static const uint64_t kNoteTitle = NetVaultNode::kString64_1;
static const uint64_t kNoteText = NetVaultNode::kText_1;
int & noteType;
int & noteSubType;
wchar_t *& noteTitle;
wchar_t *& noteText;
VaultTextNoteNode (NetVaultNode * node);
VaultTextNoteNode (const VaultTextNoteNode &); // not implemented
const VaultTextNoteNode & operator= (const VaultTextNoteNode &); // not implemented
void SetNoteType (int v);
void SetNoteSubType (int v);
void SetNoteTitle (const wchar_t v[]);
void SetNoteText (const wchar_t v[]);
#ifdef CLIENT
#ifdef CLIENT
// for kNoteType_Visit/UnVisit
void SetVisitInfo (const plAgeInfoStruct & info);
bool GetVisitInfo (plAgeInfoStruct * info);
@ -357,72 +250,34 @@ struct VaultTextNoteNode : NetVaultNodeAccess {
// VaultAgeNode
//============================================================================
struct VaultAgeNode : NetVaultNodeAccess {
VNODE_ACCESSOR(plUUID, AgeInstanceGuid, Uuid_1);
VNODE_ACCESSOR(plUUID, ParentAgeInstanceGuid, Uuid_2);
VNODE_ACCESSOR(const wchar_t *, AgeName, String64_1);
static const uint64_t kAgeInstanceGuid = NetVaultNode::kUuid_1;
static const uint64_t kParentAgeInstanceGuid = NetVaultNode::kUuid_2;
static const uint64_t kAgeName = NetVaultNode::kString64_1;
plUUID& ageInstUuid;
plUUID& parentAgeInstUuid;
wchar_t *& ageName;
VaultAgeNode (NetVaultNode * node);
VaultAgeNode (const VaultAgeNode &); // not implemented
const VaultAgeNode & operator= (const VaultAgeNode &); // not implemented
void SetAgeInstGuid (const plUUID& v);
void SetParentAgeInstGuid (const plUUID& v);
void SetAgeName (const wchar_t v[]);
VaultAgeNode (NetVaultNode * node) : NetVaultNodeAccess(node) { }
};
//============================================================================
// VaultAgeInfoNode
//============================================================================
struct VaultAgeInfoNode : NetVaultNodeAccess {
VNODE_ACCESSOR(const wchar_t *, AgeFilename, String64_2); // "Garden"
VNODE_ACCESSOR(const wchar_t *, AgeInstanceName, String64_3); // "Eder Kemo"
VNODE_ACCESSOR(const wchar_t *, AgeUserDefinedName, String64_4); // "Joe's"
VNODE_ACCESSOR(plUUID, AgeInstanceGuid, Uuid_1); // 6278b081-342a-4229-ac1b-a0b8a2658390
VNODE_ACCESSOR(plUUID, ParentAgeInstanceGuid, Uuid_2); // 9192be7f-89ef-41bc-83db-79afe451e399
VNODE_ACCESSOR(const wchar_t *, AgeDescription, Text_1); // "Stay out!"
VNODE_ACCESSOR(int32_t, AgeSequenceNumber, Int32_1);
VNODE_ACCESSOR(int32_t, AgeLanguage, Int32_3); // The language of the client that made this age
VNODE_ACCESSOR(uint32_t, AgeId, UInt32_1);
VNODE_ACCESSOR(uint32_t, AgeCzarId, UInt32_2);
VNODE_ACCESSOR(uint32_t, AgeInfoFlags, UInt32_3);
// WARNING: Do not set this. The age will not be set public this way. Use NetCliAuthSetAgePublic instead (changes this field's value in the process).
VNODE_ACCESSOR(int32_t, IsPublic, Int32_2);
VaultAgeInfoNode (NetVaultNode * node) : NetVaultNodeAccess(node) { }
static const uint64_t kAgeFilename = NetVaultNode::kString64_2; // "Garden"
static const uint64_t kAgeInstanceName = NetVaultNode::kString64_3; // "Eder Kemo"
static const uint64_t kAgeUserDefinedName = NetVaultNode::kString64_4; // "Joe's"
static const uint64_t kAgeInstanceGuid = NetVaultNode::kUuid_1; // 6278b081-342a-4229-ac1b-a0b8a2658390
static const uint64_t kParentAgeInstanceGuid = NetVaultNode::kUuid_2; // 9192be7f-89ef-41bc-83db-79afe451e399
static const uint64_t kAgeDescription = NetVaultNode::kText_1; // "Stay out!"
static const uint64_t kAgeSequenceNumber = NetVaultNode::kInt32_1;
static const uint64_t kIsPublic = NetVaultNode::kInt32_2;
static const uint64_t kAgeLanguage = NetVaultNode::kInt32_3; // The language of the client that made this age
static const uint64_t kAgeId = NetVaultNode::kUInt32_1;
static const uint64_t kAgeCzarId = NetVaultNode::kUInt32_2;
static const uint64_t kAgeInfoFlags = NetVaultNode::kUInt32_3;
wchar_t *& ageFilename;
wchar_t *& ageInstName;
wchar_t *& ageUserDefinedName;
plUUID& ageInstUuid;
plUUID& parentAgeInstUuid;
int & ageSequenceNumber;
int & ageIsPublic;
int & ageLanguage;
unsigned & ageId;
unsigned & ageCzarId;
unsigned & ageInfoFlags;
wchar_t *& ageDescription;
VaultAgeInfoNode (NetVaultNode * node);
VaultAgeInfoNode (const VaultAgeInfoNode &); // not implemented
const VaultAgeInfoNode & operator= (const VaultAgeInfoNode &); // not implemented
void SetAgeFilename (const wchar_t v[]);
void SetAgeInstName (const wchar_t v[]);
void SetAgeUserDefinedName (const wchar_t v[]);
void SetAgeInstGuid (const plUUID& v);
void SetParentAgeInstGuid (const plUUID& v);
void SetAgeSequenceNumber (int v);
void _SetAgeIsPublic (int v); // WARNING: Do not call this. The age will not be set public this way. Use NetCliAuthSetAgePublic instead (changes this field's value in the process).
void SetAgeLanguage (int v);
void SetAgeId (unsigned v);
void SetAgeCzarId (unsigned v);
void SetAgeInfoFlags (unsigned v);
void SetAgeDescription (const wchar_t v[]);
#ifdef CLIENT
const class plUnifiedTime * GetAgeTime () const;
void CopyFrom (const plAgeInfoStruct * info);
@ -434,16 +289,9 @@ struct VaultAgeInfoNode : NetVaultNodeAccess {
// VaultSystemNode
//============================================================================
struct VaultSystemNode : NetVaultNodeAccess {
VNODE_ACCESSOR(int32_t, CCRStatus, Int32_1);
static const uint64_t kCCRStatus = NetVaultNode::kInt32_1;
int & ccrStatus;
VaultSystemNode (NetVaultNode * node);
VaultSystemNode (const VaultTextNoteNode &); // not implemented
const VaultSystemNode & operator= (const VaultSystemNode &); // not implemented
void SetCCRStatus (int v);
VaultSystemNode (NetVaultNode * node) : NetVaultNodeAccess(node) { }
};
@ -451,17 +299,8 @@ struct VaultSystemNode : NetVaultNodeAccess {
// VaultMarkerGameNode
//============================================================================
struct VaultMarkerGameNode : NetVaultNodeAccess {
VNODE_ACCESSOR(const wchar_t *, GameName, Text_1);
VNODE_ACCESSOR(plUUID, GameGuid, Uuid_1);
static const uint64_t kGameName = NetVaultNode::kText_1;
static const uint64_t kGameGuid = NetVaultNode::kUuid_1;
wchar_t *& gameName;
plUUID& gameGuid;
VaultMarkerGameNode (NetVaultNode * node);
VaultMarkerGameNode (const VaultMarkerGameNode &); // not implemented
const VaultMarkerGameNode & operator= (const VaultMarkerGameNode &); // not implemented
void SetGameName (const wchar_t v[]);
void SetGameGuid (const plUUID& v);
VaultMarkerGameNode (NetVaultNode * node) : NetVaultNodeAccess(node) { }
};

Loading…
Cancel
Save