pak.types.misc¶
Miscellaneous Types.
- class EmptyType¶
Bases:
TypeA
Typeof no value.It always unpacks to
Noneand always packs tob"". It is useful in certain cases when you would want to “disable” a packet field, for instance.Noneis a typelike value that translates toEmptyType.
- class Padding¶
Bases:
TypeA single byte of padding.
This
Typewill marshal one byte toNone, and any value tob"\x00".It is also special-cased in
Arrayfor padding of larger length.
- class RawByte¶
Bases:
TypeA single byte of data.
The main reason this exists is to be used along with
Array, for which thisTypeis special-cased to produce abytearrayvalue.
- class StructType¶
Bases:
TypeA wrapper over
struct.pack()andstruct.unpack().- fmt¶
The format string for the structure, not including the endianness prefix.
- Type:
str
- endian¶
The endianness prefix used in
struct.By default little-endian.
- Type:
str
- classmethod big_endian()¶
Gets a big-endian version of the
StructType.- Returns:
If the
StructTypeis already big-endian, then it is simply returned.Otherwise, a subclass with the proper endianness is returned.
- Return type:
subclass of
StructType
- endian = '<'¶
- fmt = None¶
- classmethod little_endian()¶
Gets a little-endian version of the
StructType.- Returns:
If the
StructTypeis already little-endian, then it is simply returned.Otherwise, a subclass with the proper endianness is returned.
- Return type:
subclass of
StructType
- classmethod native_endian()¶
Gets a native-endian version of the
StructType.- Returns:
If the
StructTypeis already native-endian, then it is simply returned.Otherwise, a subclass with the proper endianness is returned.
- Return type:
subclass of
StructType