class Ronin::Support::Binary::CTypes::OS
Represents additional typedefs defined by an Operating System (OS
).
@api private
@since 1.0.0
Attributes
The defined typedefs for the OS
.
@return [Hash{Symbol => Type}]
The base types that the OS
inherits.
@return [Native, LittleEndian
, BigEndian
, Network
,
Arch::ARM, Arch::ARM::BigEndian, Arch::ARM64, Arch::ARM64::BigEndian, Arch::MIPS, Arch::MIPS::LittleEndian, Arch::MIPS64, Arch::MIPS64::LittleEndian, Arch::PPC64, Arch::PPC, Arch::X86_64, Arch::X86, OS::FreeBSD, OS::NetBSD, OS::OpenBSD, OS::Linux, OS::MacOS, OS::Windows, OS::Android, OS::AppleIOS]
Public Class Methods
Source
# File lib/ronin/support/binary/ctypes/os.rb, line 73 def initialize(types) @types = types @typedefs = {} end
Initializes the OS
with the given base types.
@param [Native, LittleEndian
, BigEndian
, Network
,
Arch::ARM, Arch::ARM::BigEndian, Arch::ARM64, Arch::ARM64::BigEndian, Arch::MIPS, Arch::MIPS::LittleEndian, Arch::MIPS64, Arch::MIPS64::LittleEndian, Arch::PPC64, Arch::PPC, Arch::X86_64, Arch::X86, OS::FreeBSD, OS::NetBSD, OS::OpenBSD, OS::Linux, OS::MacOS, OS::Windows, OS::Android] types The base types that the OS builds upon.
Public Instance Methods
Source
# File lib/ronin/support/binary/ctypes/os.rb, line 87 def [](name) @typedefs.fetch(name) { @types[name] } end
Retrieves the type with the given name.
@param [Symbol] name
@return [Type]
@api public
Source
# File lib/ronin/support/binary/ctypes/os.rb, line 106 def typedef(type,new_name) case type when Type then @typedefs[new_name] = type when Symbol then @typedefs[new_name] = self[type] else raise(ArgumentError,"type must be either a Symbol or a #{Type}: #{type.inspect}") end end
Defines a typedef within the type system.
@param [Symbol, Type] type
The original type to point to.
@param [Symbol] new_name
The new type name.
@raise [ArgumentError]
The given type was not a Symbol or a {Type}.
@example
os.typedef :uint, :foo_t