EvEmu
0.8.4
11 September 2021
|
Class which turns marshal bytecode into Python object. More...
#include "EVEUnmarshal.h"
Public Member Functions | |
UnmarshalStream () | |
~UnmarshalStream () | |
PyRep * | Load (const Buffer &data) |
Loads Python object from given bytecode. More... | |
Protected Member Functions | |
template<typename T > | |
const T & | Peek () const |
template<typename T > | |
Buffer::const_iterator< T > | Peek (size_t count) const |
template<typename T > | |
const T & | Read () |
template<typename T > | |
Buffer::const_iterator< T > | Read (size_t count) |
uint32 | ReadSizeEx () |
PyRep * | LoadStream (size_t streamLength) |
PyRep * | LoadRep () |
void | CreateObjectStore (size_t streamLength, uint32 saveCount) |
Initializes object store. More... | |
void | DestroyObjectStore () |
Destroys object store. More... | |
uint32 | GetStorageIndex () |
Obtains storage index for StoreObject. More... | |
PyRep * | GetStoredObject (uint32 index) |
Obtains previously stored object. More... | |
void | StoreObject (uint32 index, PyRep *object) |
Stores object. More... | |
Private Attributes | |
Buffer::const_iterator< uint8 > | mInItr |
Buffer::const_iterator< uint32 > | mStoreIndexItr |
PyList * | mStoredObjects |
Static Private Attributes | |
static PyRep *(UnmarshalStream::*const | s_mLoadMap [])() |
Class which turns marshal bytecode into Python object.
Definition at line 54 of file EVEUnmarshal.h.
|
inline |
Definition at line 57 of file EVEUnmarshal.h.
UnmarshalStream::~UnmarshalStream | ( | ) |
Definition at line 58 of file EVEUnmarshal.cpp.
|
protected |
Initializes object store.
[in] | streamLength | Length of stream. |
[in] | saveCount | Number of saved objects within the stream. |
Definition at line 181 of file EVEUnmarshal.cpp.
References DestroyObjectStore(), mInItr, mStoredObjects, and mStoreIndexItr.
Referenced by LoadStream().
|
protected |
Destroys object store.
Definition at line 192 of file EVEUnmarshal.cpp.
References mStoredObjects, mStoreIndexItr, and PySafeDecRef.
Referenced by CreateObjectStore(), and LoadStream().
|
inlineprotected |
Obtains storage index for StoreObject.
Definition at line 126 of file EVEUnmarshal.h.
References mStoreIndexItr.
Referenced by LoadRep().
Obtains previously stored object.
[in] | index | Index of stored object. |
Definition at line 198 of file EVEUnmarshal.cpp.
References PyList::GetItem(), and mStoredObjects.
Referenced by LoadSavedStreamElement().
Loads Python object from given bytecode.
[in] | data | Buffer containing marshal bytecode. |
Definition at line 134 of file EVEUnmarshal.cpp.
References Buffer::begin(), LoadStream(), mInItr, and Buffer::size().
Referenced by Unmarshal().
|
inlineprivate |
Loads false boolean from stream.
Definition at line 150 of file EVEUnmarshal.h.
References PyStatic.
|
inlineprivate |
|
private |
Loads buffer from stream.
Definition at line 328 of file EVEUnmarshal.cpp.
References ReadSizeEx().
|
private |
Loads checksumed stream from stream.
Definition at line 495 of file EVEUnmarshal.cpp.
References LoadRep().
|
private |
Loads dict from stream.
Definition at line 418 of file EVEUnmarshal.cpp.
References key(), LoadRep(), PyDecRef, ReadSizeEx(), and PyDict::SetItem().
|
private |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
private |
Loads variable length integer from stream.
Definition at line 214 of file EVEUnmarshal.cpp.
References ReadSizeEx().
|
inlineprivate |
|
private |
Loads list from stream.
Definition at line 386 of file EVEUnmarshal.cpp.
References LoadRep(), PyDecRef, ReadSizeEx(), and PyList::SetItem().
|
inlineprivate |
|
private |
Loads one-element list from stream.
Definition at line 406 of file EVEUnmarshal.cpp.
References PyList::AddItem(), and LoadRep().
|
inlineprivate |
|
private |
Loads object from stream.
Definition at line 442 of file EVEUnmarshal.cpp.
References PyRep::AsString(), PyRep::IsString(), LoadRep(), PyDecRef, sLog, and PyRep::TypeString().
|
private |
Helper; loads extended object from stream.
Definition at line 713 of file EVEUnmarshal.cpp.
References PyList::AddItem(), PyObjectEx::dict(), key(), PyObjectEx::list(), LoadRep(), Op_PackedTerminator, PyDecRef, and PyDict::SetItem().
Referenced by LoadObjectEx1(), and LoadObjectEx2().
|
private |
Loads extended object of type 1 from stream.
Definition at line 466 of file EVEUnmarshal.cpp.
References LoadObjectEx().
|
private |
Loads extended object of type 2 from stream.
Definition at line 471 of file EVEUnmarshal.cpp.
References LoadObjectEx().
|
private |
Loads packed row from stream.
Definition at line 506 of file EVEUnmarshal.cpp.
References Buffer::const_iterator< T >::As(), Buffer::begin(), DBRowDescriptor::ColumnCount(), DBTYPE_BOOL, DBTYPE_BYTES, DBTYPE_CY, DBTYPE_EMPTY, DBTYPE_ERROR, DBTYPE_FILETIME, DBTYPE_GetSizeBits(), DBTYPE_I1, DBTYPE_I2, DBTYPE_I4, DBTYPE_I8, DBTYPE_R4, DBTYPE_R8, DBTYPE_STR, DBTYPE_UI1, DBTYPE_UI2, DBTYPE_UI4, DBTYPE_UI8, DBTYPE_WSTR, DBRowDescriptor::GetColumnType(), PyPackedRow::header(), LoadRep(), LoadRLE(), PyDecRef, and PyPackedRow::SetField().
|
inlineprivate |
|
inlineprivate |
|
protected |
Loads rep from stream.
Definition at line 160 of file EVEUnmarshal.cpp.
References GetStorageIndex(), PyRepOpcodeMask, PyRepSaveMask, PyRepUnknownMask, s_mLoadMap, sLog, and StoreObject().
Referenced by LoadChecksumedStream(), LoadDict(), LoadList(), LoadListOne(), LoadObject(), LoadObjectEx(), LoadPackedRow(), LoadStream(), LoadSubStruct(), LoadTuple(), LoadTupleOne(), and LoadTupleTwo().
|
private |
Helper; loads zero-compressed buffer from stream.
Definition at line 760 of file EVEUnmarshal.cpp.
References ReadSizeEx(), and Buffer::size().
Referenced by LoadPackedRow().
|
private |
Loads saved stream element from stream.
Definition at line 699 of file EVEUnmarshal.cpp.
References PyRep::Clone(), GetStoredObject(), ReadSizeEx(), and sLog.
|
protected |
Initializes loading and loads rep from stream.
Definition at line 143 of file EVEUnmarshal.cpp.
References CreateObjectStore(), DestroyObjectStore(), LoadRep(), MarshalHeaderByte, and sLog.
Referenced by Load().
|
private |
|
inlineprivate |
|
private |
Loads long (no limit) string from stream.
Definition at line 263 of file EVEUnmarshal.cpp.
References ReadSizeEx().
|
private |
|
private |
Loads table string from stream.
Definition at line 271 of file EVEUnmarshal.cpp.
References sLog, sMarshalStringTable, and snprintf.
|
private |
Loads sub stream from stream.
Definition at line 476 of file EVEUnmarshal.cpp.
References ReadSizeEx().
|
private |
Loads sub struct from stream.
Definition at line 484 of file EVEUnmarshal.cpp.
References LoadRep().
|
private |
|
private |
Loads tuple from stream.
Definition at line 336 of file EVEUnmarshal.cpp.
References LoadRep(), PyDecRef, ReadSizeEx(), and PyTuple::SetItem().
|
inlineprivate |
|
private |
Loads one-element tuple from stream.
Definition at line 354 of file EVEUnmarshal.cpp.
References LoadRep(), and PyTuple::SetItem().
|
private |
Loads two-element tuple from stream.
Definition at line 366 of file EVEUnmarshal.cpp.
References LoadRep(), PyDecRef, and PyTuple::SetItem().
|
inlineprivate |
|
private |
Loads UCS-2 string from stream.
Definition at line 300 of file EVEUnmarshal.cpp.
References ReadSizeEx(), and utf16to8().
|
private |
Loads single UCS-2 character string from stream.
Definition at line 289 of file EVEUnmarshal.cpp.
References utf16to8().
|
private |
Loads UTF-8 string from stream.
Definition at line 312 of file EVEUnmarshal.cpp.
References ReadSizeEx().
|
inlineprotected |
Peeks element from stream.
Definition at line 76 of file EVEUnmarshal.h.
|
inlineprotected |
Peeks elements from stream.
Definition at line 79 of file EVEUnmarshal.h.
References Buffer::const_iterator< T >::As(), and mInItr.
|
inlineprotected |
Reads element from stream.
Definition at line 83 of file EVEUnmarshal.h.
|
inlineprotected |
|
inlineprotected |
Reads extended size from stream.
Definition at line 94 of file EVEUnmarshal.h.
Referenced by LoadBuffer(), LoadDict(), LoadIntegerVar(), LoadList(), LoadRLE(), LoadSavedStreamElement(), LoadStringLong(), LoadSubStream(), LoadTuple(), LoadWStringUCS2(), and LoadWStringUTF8().
Stores object.
[in] | index | Index of object. |
[in] | object | The object to be stored. |
Definition at line 205 of file EVEUnmarshal.cpp.
References mStoredObjects, PyIncRef, and PyList::SetItem().
Referenced by LoadRep().
|
private |
Buffer iterator we are processing.
Definition at line 247 of file EVEUnmarshal.h.
Referenced by CreateObjectStore(), Load(), Peek(), and Read().
|
private |
Referenced objects within the buffer.
Definition at line 252 of file EVEUnmarshal.h.
Referenced by CreateObjectStore(), DestroyObjectStore(), GetStoredObject(), and StoreObject().
|
private |
Next store index for referencing in the buffer.
Definition at line 250 of file EVEUnmarshal.h.
Referenced by CreateObjectStore(), DestroyObjectStore(), and GetStorageIndex().
|
staticprivate |