dissect.cstruct.types.structure#

Module Contents#

Classes#

Field

Holds a structure field.

Structure

Type class for structures.

Union

Type class for unions

class dissect.cstruct.types.structure.Field(name: str, type_: dissect.cstruct.types.BaseType, bits: int = None, offset: int = None)#

Holds a structure field.

__repr__()#

Return repr(self).

class dissect.cstruct.types.structure.Structure(cstruct: Structure.__init__.cstruct, name: str, fields: List[Field] = None, align: bool = False, anonymous: bool = False)#

Bases: dissect.cstruct.types.BaseType

Type class for structures.

__len__() int#
__repr__() str#

Return repr(self).

add_field(name: str, type_: dissect.cstruct.types.BaseType, bits: int = None, offset: int = None) None#

Add a field to this structure.

Parameters:
  • name – The field name.

  • type – The field type.

  • bits – The bit of the field.

  • offset – The field offset.

default() dissect.cstruct.types.Instance#

Create and return an empty Instance from this structure.

Returns:

An empty Instance from this structure.

show(indent: int = 0) None#

Pretty print this structure.

class dissect.cstruct.types.structure.Union(cstruct: Structure.__init__.cstruct, name: str, fields: List[Field] = None, align: bool = False, anonymous: bool = False)#

Bases: Structure

Type class for unions

__repr__() str#

Return repr(self).

abstract show(indent: int = 0) None#

Pretty print this structure.