Module: Ronin::Support::Binary::CTypes::BigEndian

Includes:
CharTypes
Included in:
Arch::ARM64::BigEndian, Arch::ARM::BigEndian, Arch::MIPS, Arch::MIPS64, Arch::PPC, Arch::PPC64
Defined in:
lib/ronin/support/binary/ctypes/big_endian.rb

Overview

Represents the C types, but in big-endian byte-order.

Constant Summary collapse

ADDRESS_SIZE =

The size of a native pointer in bytes.

Returns:

  • (4, 8)
Native::ADDRESS_SIZE
INT8 =

The int8_t type.

Int8Type.new
INT16 =

The int16_t type (big-endianness).

Int16Type.new(endian: :big, pack_string: 's>')
INT32 =

The int32_t type (big-endianness).

Int32Type.new(endian: :big, pack_string: 'l>')
INT64 =

The int64_t type (big-endianness).

Int64Type.new(endian: :big, 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 (big-endianness).

UInt16Type.new(endian: :big, pack_string: 'S>')
UINT32 =

The uint32_t type (big-endianness).

UInt32Type.new(endian: :big, pack_string: 'L>')
UINT64 =

The uint64_t type (big-endianness).

UInt64Type.new(endian: :big, 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 big-endian unsigned integer).

UINT16
DWORD =

The "dword" type (32-bit big-endian unsigned integer).

UINT32
QWORD =

The "qword" type (64-bit big-endian unsigned integer).

UINT64
MACHINE_WORD =

The "machine word" type.

Returns:

if ADDRESS_SIZE == 8 then UINT64
else                      UINT32
end
POINTER =

The void * type.

MACHINE_WORD
FLOAT32 =

The float type (big-endianness).

Float32Type.new(endian: :big, pack_string: 'g')
FLOAT =

The float type (big-endianness).

FLOAT32
FLOAT64 =

The double type (big-endianness).

Float64Type.new(endian: :big, pack_string: 'G')
DOUBLE =

The double type (big-endianness).

FLOAT64
TYPES =

The big-endian 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

Class Method Details

.[](name) ⇒ Type

Fetches the type from TYPES.

Parameters:

  • name (Symbol)

    The type name to lookup.

Returns:

Raises:

  • (ArgumentError)

    The type name was unknown.



189
190
191
192
193
# File 'lib/ronin/support/binary/ctypes/big_endian.rb', line 189

def self.[](name)
  TYPES.fetch(name) do
    raise(ArgumentError,"unknown type: #{name.inspect}")
  end
end