dissect.cstruct.types.structure
¶
Module Contents¶
Classes¶
Structure field. |
|
Base metaclass for cstruct structure type classes. |
|
Base class for cstruct structure type classes. |
|
Base metaclass for cstruct union type classes. |
|
Base class for cstruct union type classes. |
|
Functions¶
Generates an |
|
Generates an |
|
Generates an |
|
Generates a |
|
Generates a |
|
Generates an |
|
Generates an |
|
Generates an |
|
Generates a |
|
Generates a |
- class dissect.cstruct.types.structure.Field(name: str, type_: dissect.cstruct.types.base.MetaType, bits: int | None = None, offset: int | None = None)¶
Structure field.
- name¶
- type¶
- bits = None¶
- offset = None¶
- alignment¶
- __repr__() str ¶
- class dissect.cstruct.types.structure.StructureMetaType¶
Bases:
dissect.cstruct.types.base.MetaType
Base metaclass for cstruct structure type classes.
- fields: dict[str, Field]¶
Mapping of field names to
Field
objects, including “folded” fields from anonymous structures.
- lookup: dict[str, Field]¶
Mapping of “raw” field names to
Field
objects. E.g. holds the anonymous struct and not its fields.
- __fields__: list[Field]¶
List of
Field
objects for this structure. This is the structures’ Single Source Of Truth.
- __align__: bool¶
- __anonymous__: bool¶
- __updating__ = False¶
- __compiled__ = False¶
- __call__(*args, **kwargs) Structure ¶
Adds support for
TypeClass(bytes | file-like object)
parsing syntax.
- add_field(name: str, type_: dissect.cstruct.types.base.BaseType, bits: int | None = None, offset: int | None = None) None ¶
- start_update() collections.abc.Iterator[None] ¶
- commit() None ¶
- class dissect.cstruct.types.structure.Structure¶
Bases:
dissect.cstruct.types.base.BaseType
Base class for cstruct structure type classes.
- __len__() int ¶
Return the byte size of the type.
- __getitem__(item: str) Any ¶
- __repr__() str ¶
- class dissect.cstruct.types.structure.UnionMetaType¶
Bases:
StructureMetaType
Base metaclass for cstruct union type classes.
- class dissect.cstruct.types.structure.Union¶
Bases:
Structure
Base class for cstruct union type classes.
- __eq__(other: object) bool ¶
- __setattr__(attr: str, value: Any) None ¶
- class dissect.cstruct.types.structure.UnionProxy(union: Union, attr: str, target: Structure)¶
-
- __attr__: str¶
- __len__() int ¶
- __getitem__(item: str) Any ¶
- __repr__() str ¶
- __getattr__(attr: str) Any ¶
- __setattr__(attr: str, value: Any) None ¶
- dissect.cstruct.types.structure.attrsetter(path: str) Callable[[Any], Any] ¶
- dissect.cstruct.types.structure._make_structure__init__(fields: list[str]) str ¶
Generates an
__init__
method for a structure with the specified fields.- Parameters:
fields – List of field names.
- dissect.cstruct.types.structure._make_union__init__(fields: list[str]) str ¶
Generates an
__init__
method for a class with the specified fields using setattr.- Parameters:
fields – List of field names.
- dissect.cstruct.types.structure._make__eq__(fields: list[str]) str ¶
Generates an
__eq__
method for a class with the specified fields.- Parameters:
fields – List of field names.
- dissect.cstruct.types.structure._make__bool__(fields: list[str]) str ¶
Generates a
__bool__
method for a class with the specified fields.- Parameters:
fields – List of field names.
- dissect.cstruct.types.structure._make__hash__(fields: list[str]) str ¶
Generates a
__hash__
method for a class with the specified fields.- Parameters:
fields – List of field names.
- dissect.cstruct.types.structure._generate_structure__init__(fields: list[Field]) types.FunctionType ¶
Generates an
__init__
method for a structure with the specified fields.- Parameters:
fields – List of field names.
- dissect.cstruct.types.structure._generate_union__init__(fields: list[Field]) types.FunctionType ¶
Generates an
__init__
method for a union with the specified fields.- Parameters:
fields – List of field names.
- dissect.cstruct.types.structure._generate__eq__(fields: list[str]) types.FunctionType ¶
Generates an
__eq__
method for a class with the specified fields.- Parameters:
fields – List of field names.
- dissect.cstruct.types.structure._generate__bool__(fields: list[str]) types.FunctionType ¶
Generates a
__bool__
method for a class with the specified fields.- Parameters:
fields – List of field names.
- dissect.cstruct.types.structure._generate__hash__(fields: list[str]) types.FunctionType ¶
Generates a
__hash__
method for a class with the specified fields.- Parameters:
fields – List of field names.