![]() |
CRM64Pro GDK v0.18.0
A free cross-platform game development kit built on top of SDL 3.0
|
Archive Object class.
Classes | |
| struct | Block |
| class | BlockStream |
| Archive raw block stream. More... | |
Public Types | |
| using | BlockReadCallback = Sint64(*)(void* pUser, void* pBuffer, Uint64 iMaxBytes) |
Public Member Functions | |
| bool | info (Sint32 iMode=0) override |
| Request CDC object information. | |
| const string & | getName () const override |
| Get the name. | |
| Sint32 | getID () const override |
| Get the ID. | |
| bool | isEncrypted () const |
| Check if the CDC index is encrypted. | |
| bool | isEncryptedBlocks () const |
| Check if the CDC contains encrypted blocks. | |
| bool | hasKey () const |
| Check if a CDC confidentiality key is set in memory. | |
| Sint32 | blockAdd (Block &rBlock) |
| Add a data block. | |
| Sint32 | blockAddStream (Block &rBlock, BlockReadCallback fnRead, void *pUser) |
| Add a streamed data block. | |
| Sint32 | blockAddFile (const string &sFile, eArchiveBlockStore eABS=ABS_COMPRESSED) |
| Add a file. | |
| Sint32 | blockDelete (Block &rBlock) |
| Delete a data block. | |
| Sint32 | blockUndelete (Uint32 iBlock, const char *szName=nullptr) |
| Recover a deleted data block. | |
| Sint32 | blockSearch (Block &rBlock) |
| Search for a given data block. | |
| Sint32 | blockAt (Uint32 iBlock, Block &rBlock) |
| Access to the given data block position. | |
| Sint32 | blockLoad (Block &rBlock) |
| Load a data block. | |
| Sint32 | blockVerify (Block &rBlock) |
| Verify a data block. | |
| Sint32 | blockFree (Block &rBlock) |
| Free a loaded data block. | |
| Sint32 | blockOpenStream (Block &rBlock, BlockStream &rStream) |
| Open a raw block stream. | |
| Uint32 | getBlockCount () const |
| Get the number of active block entries. | |
| Uint32 | getIndexCount () const |
| Get the number of used index entries. | |
| Uint32 | getBlockLimit () const |
| Get the number of maximum data blocks. | |
| float | getFragmentation () const |
| Get the fragmentation. | |
| string | getCreationDate () const |
| Get the CDC creation date. | |
| string | getModificationDate () const |
| Get the CDC modification date. | |
| Uint64 | getCreationTime () const |
| Get the CDC creation timestamp. | |
| Uint64 | getModificationTime () const |
| Get the CDC modification timestamp. | |
| Sint32 | setKey (const Uint8 *pKey, Uint32 iKeySize) |
| Set the CDC confidentiality key. | |
| Sint32 | clearKey () |
| Clear the in-memory CDC encryption key. | |
| Sint32 | encrypt () |
| Apply confidentiality to the CDC index. | |
| Sint32 | decrypt () |
| Remove confidentiality from the CDC index. | |
| using CRM64Pro::Archive::BlockReadCallback = Sint64(*)(void* pUser, void* pBuffer, Uint64 iMaxBytes) |
Callback used by blockAddStream() to provide source bytes. Return the number of bytes copied into pBuffer, 0 for end of stream, or a negative error code on failure.
|
override |
Request CDC object information.
Writes information to the default log.
| iMode | Reserved for future use. Pass 0. |
|
override |
Get the name.
|
override |
Get the ID.
| bool CRM64Pro::Archive::isEncrypted | ( | ) | const |
Check if the CDC index is encrypted.
| bool CRM64Pro::Archive::isEncryptedBlocks | ( | ) | const |
Check if the CDC contains encrypted blocks.
| bool CRM64Pro::Archive::hasKey | ( | ) | const |
Check if a CDC confidentiality key is set in memory.
| Sint32 CRM64Pro::Archive::blockAdd | ( | Block & | rBlock | ) |
Add a data block.
| rBlock | filled Block struct, at least it needs pData, iSize, name and type. |
| Sint32 CRM64Pro::Archive::blockAddStream | ( | Block & | rBlock, |
| BlockReadCallback | fnRead, | ||
| void * | pUser ) |
Add a streamed data block.
| rBlock | filled Block struct with iSize, storage mode, name and type. pData is ignored. |
| fnRead | Callback used to provide block bytes. |
| pUser | User pointer passed to the callback. |
| Sint32 CRM64Pro::Archive::blockAddFile | ( | const string & | sFile, |
| eArchiveBlockStore | eABS = ABS_COMPRESSED ) |
Add a file.
| sFile | string containing the [directory]+filename+[extension] to be added. Directory separators '\' and '/' are supported. |
| eABS | Check ::eArchiveBlockStore enum for details. Default is ABS_COMPRESSED. |
| Sint32 CRM64Pro::Archive::blockDelete | ( | Block & | rBlock | ) |
Delete a data block.
| rBlock | filled Block struct with block name and type. |
| Sint32 CRM64Pro::Archive::blockUndelete | ( | Uint32 | iBlock, |
| const char * | szName = nullptr ) |
Recover a deleted data block.
| iBlock | block index position from [0 to used_index_entries - 1] which contains a deleted data block. Use getIndexCount() to get used_index_entries. |
| szName | optional new block name. Use nullptr or an empty string to restore the original deleted name. The original block type is always preserved. |
| Sint32 CRM64Pro::Archive::blockSearch | ( | Block & | rBlock | ) |
Search for a given data block.
| rBlock | filled Block struct with block name and type. If found, rBlock will contain all attributes except pData. |
| Sint32 CRM64Pro::Archive::blockAt | ( | Uint32 | iBlock, |
| Block & | rBlock ) |
Access to the given data block position.
| iBlock | block index position from [0 to used_index_entries - 1]. Use getIndexCount() for the used_index_entries value. |
| rBlock | if the block index position is found, rBlock will contain all attributes except pData. |
| Sint32 CRM64Pro::Archive::blockLoad | ( | Block & | rBlock | ) |
Load a data block.
| rBlock | filled Block struct with block name and type. pData must be nullptr. If found, rBlock will contain all attributes plus the pData loaded. |
| Sint32 CRM64Pro::Archive::blockVerify | ( | Block & | rBlock | ) |
Verify a data block.
| rBlock | filled Block struct with block name and type. If verified, rBlock will contain all attributes except pData. |
| Sint32 CRM64Pro::Archive::blockFree | ( | Block & | rBlock | ) |
Free a loaded data block.
| rBlock | Block struct with pData previously loaded by blockLoad(). |
| Sint32 CRM64Pro::Archive::blockOpenStream | ( | Block & | rBlock, |
| BlockStream & | rStream ) |
Open a raw block stream.
| rBlock | filled Block struct with block name and type. If opened, the block metadata is filled. |
| rStream | BlockStream object that receives the opened stream. |
| Uint32 CRM64Pro::Archive::getBlockCount | ( | ) | const |
Get the number of active block entries.
| Uint32 CRM64Pro::Archive::getIndexCount | ( | ) | const |
Get the number of used index entries.
| Uint32 CRM64Pro::Archive::getBlockLimit | ( | ) | const |
Get the number of maximum data blocks.
The archive grows this limit automatically when possible, and it can also be resized using defrag().
| float CRM64Pro::Archive::getFragmentation | ( | ) | const |
Get the fragmentation.
| string CRM64Pro::Archive::getCreationDate | ( | ) | const |
Get the CDC creation date.
| string CRM64Pro::Archive::getModificationDate | ( | ) | const |
Get the CDC modification date.
| Uint64 CRM64Pro::Archive::getCreationTime | ( | ) | const |
Get the CDC creation timestamp.
| Uint64 CRM64Pro::Archive::getModificationTime | ( | ) | const |
Get the CDC modification timestamp.
| Sint32 CRM64Pro::Archive::setKey | ( | const Uint8 * | pKey, |
| Uint32 | iKeySize ) |
Set the CDC confidentiality key.
| pKey | Uint8 array of iKeySize containing the key. |
| iKeySize | the key size in bytes. Values from 1 to 32 are accepted. The internal AES-256 key is derived from this key and the archive key salt. |
| Sint32 CRM64Pro::Archive::clearKey | ( | ) |
Clear the in-memory CDC encryption key.
| Sint32 CRM64Pro::Archive::encrypt | ( | ) |
Apply confidentiality to the CDC index.
The archive header and stored block payloads are left unchanged. Blocks keep their own storage mode: raw, compressed or encrypted. Index encryption provides lightweight confidentiality, not cryptographic authentication.
| Sint32 CRM64Pro::Archive::decrypt | ( | ) |
Remove confidentiality from the CDC index.
The archive header and stored block payloads are left unchanged.