Module: Ronin::Support::Binary::CTypes::Native
- Includes:
- CharTypes
- Included in:
- Ronin::Support::Binary::CTypes
- Defined in:
- lib/ronin/support/binary/ctypes/native.rb
Overview
Represents the system's native C types.
Constant Summary collapse
- ENDIAN =
The native endian-ness.
if [0x1].pack('S') == [0x1].pack('S>') :big else :little end
- ADDRESS_SIZE =
The size of a native pointer in bytes.
if RbConfig::CONFIG['host_cpu'].include?('64') 8 else 4 end
- INT8 =
The
int8_t
type. Int8Type.new
- INT16 =
The
int16_t
type (native-endianness). Int16Type.new(endian: ENDIAN, pack_string: 's')
- INT32 =
The
int32_t
type (native-endianness). Int32Type.new(endian: ENDIAN, pack_string: 'l')
- INT64 =
The
int64_t
type (native-endianness). Int64Type.new(endian: ENDIAN, pack_string: 'q')
- SHORT =
The
short
type. INT16
- INT =
The
int
type. INT32
- LONG =
The
long
type. if ADDRESS_SIZE == 8 then INT64 else INT32 end
- LONG_LONG =
The
long long
type. INT64
- UINT8 =
The
uint8_t
type. UInt8Type.new
- UINT16 =
The
uint16_t
type (native-endianness). UInt16Type.new(endian: ENDIAN, pack_string: 'S')
- UINT32 =
The
uint32_t
type (native-endianness). UInt32Type.new(endian: ENDIAN, pack_string: 'L')
- UINT64 =
The
uint64_t
type (native-endianness). UInt64Type.new(endian: ENDIAN, pack_string: 'Q')
- BYTE =
The
byte
type. UINT8
- USHORT =
The
unsigned short
type. UINT16
- UINT =
The
unsigned int
type. UINT32
- ULONG =
The
unsigned long
type. if ADDRESS_SIZE == 8 then UINT64 else UINT32 end
- ULONG_LONG =
The
unsigned long long
type. UINT64
- WORD =
The "word" type (16-bit unsigned integer).
UINT16
- DWORD =
The "dword" type (32-bit unsigned integer).
UINT32
- QWORD =
The "qword" type (64-bit unsigned integer).
UINT64
- MACHINE_WORD =
The "machine word" type.
if ADDRESS_SIZE == 8 then UINT64 else UINT32 end
- POINTER =
The
void *
type. MACHINE_WORD
- FLOAT32 =
The
float
type (native-endianness). Float32Type.new(endian: ENDIAN, pack_string: 'f')
- FLOAT =
The
float
type (native-endianness). FLOAT32
- FLOAT64 =
The
double
type (native-endianness). Float64Type.new(endian: ENDIAN,pack_string: 'd')
- DOUBLE =
The
double
type (native-endianness). FLOAT64
- TYPES =
The native types.
{ int8: INT8, int16: INT16, int32: INT32, int64: INT64, short: SHORT, int: INT, long: LONG, long_long: LONG_LONG, uint8: UINT8, uint16: UINT16, uint32: UINT32, uint64: UINT64, byte: BYTE, ushort: USHORT, uint: UINT, ulong: ULONG, ulong_long: ULONG_LONG, word: WORD, dword: DWORD, qword: QWORD, machine_word: MACHINE_WORD, pointer: MACHINE_WORD, float32: FLOAT32, float64: FLOAT64, float: FLOAT, double: DOUBLE, char: CHAR, uchar: UCHAR, cstring: STRING, string: STRING }
Constants included from CharTypes
CharTypes::CHAR, CharTypes::STRING, CharTypes::UCHAR
Class Method Summary collapse
-
.[](name) ⇒ Type
Fetches the type from TYPES.