BinaryViewType

Struct BinaryViewType 

Source
pub struct BinaryViewType {
    pub handle: *mut BNBinaryViewType,
}
Expand description

A BinaryViewType acts as a factory for BinaryView objects.

Each file format will have its own type, such as PE, ELF, or Mach-O.

Custom view types can be implemented using CustomBinaryViewType.

Fields§

§handle: *mut BNBinaryViewType

Implementations§

Source§

impl BinaryViewType

Source

pub fn list_all() -> Array<BinaryViewType>

Source

pub fn valid_types_for_data(data: &BinaryView) -> Array<BinaryViewType>

Enumerates all view types and checks to see if the given raw BinaryView is valid, returning only those that are.

Source

pub fn by_name(name: &str) -> Option<Self>

Looks up a binary view type by its name (not the long name).

Source

pub fn name(&self) -> String

The given name for the binary view type.

Source

pub fn long_name(&self) -> String

The given long name for the binary view type.

Source

pub fn register_arch<A: Architecture>( &self, id: u32, endianness: Endianness, arch: &A, )

Register an architecture for selection via the id and endianness.

If you need to peak at the BinaryView to determine the architecture, use BinaryViewType::register_platform_recognizer instead of this.

Source

pub fn register_platform(&self, id: u32, plat: &Platform)

Register a platform for selection via the id.

If you need to peak at the BinaryView to determine the platform, use BinaryViewType::register_platform_recognizer instead of this.

Source

pub fn register_platform_recognizer<R>( &self, id: u32, endian: Endianness, recognizer: R, )
where R: 'static + Fn(&BinaryView, &Metadata) -> Option<Ref<Platform>> + Send + Sync,

Expanded identification of Platform for BinaryViewType’s. Supersedes BinaryViewType::register_arch and BinaryViewType::register_platform, as these have certain edge cases (overloaded elf families, for example) that can’t be represented.

The callback returns a Platform object or None (failure), and most recently added callbacks are called first to allow plugins to override any default behaviors. When a callback returns a platform, architecture will be derived from the identified platform.

The BinaryView is the parent view (usually ‘Raw’) that the BinaryView is being created for. This means that generally speaking, the callbacks need to be aware of the underlying file format. However, the BinaryView implementation may have created data variables in the ‘Raw’ view by the time the callback is invoked. Behavior regarding when this callback is invoked and what has been made available in the BinaryView passed as an argument to the callback is up to the discretion of the BinaryView implementation.

The id ind endian arguments are used as a filter to determine which registered Platform recognizer callbacks are invoked.

Support for this API tentatively requires explicit support in the BinaryView implementation.

Source

pub fn create(&self, data: &BinaryView) -> Result<Ref<BinaryView>, ()>

Creates a new instance of the binary view for this given type, constructed with data as the parent view.

This will also call the initialization routine for the view, after calling this you should be able to use the view as normal and ready to start analysis with BinaryView::update_analysis.

Source

pub fn parse(&self, data: &BinaryView) -> Result<Ref<BinaryView>, ()>

Creates a new instance of the binary view for parsing, this is a “specialize” version of the regular BinaryViewType::create and is expected to be used when you only want to have the view parsed and populated with information required for configuration, like with open with options.

Source

pub fn is_valid_for(&self, data: &BinaryView) -> bool

Is this BinaryViewType valid for the given the raw BinaryView?

Typical implementations will read the magic bytes (e.g. ‘MZ’), this is a performance-sensitive path so prefer inexpensive checks rather than comprehensive ones.

Source

pub fn is_deprecated(&self) -> bool

Is this BinaryViewType deprecated and should not be used?

We specify this such that the view type may still be used by existing databases, but not newly created views.

Source

pub fn is_force_loadable(&self) -> bool

Is this BinaryViewType able to be loaded forcefully?

If so, it will be shown in the drop-down when a user opens a file with options.

Source

pub fn has_no_initial_content(&self) -> bool

Do instances of this BinaryViewType start with no loaded content?

When true, the view has no meaningful default state: the user must make a selection (e.g. load images from a shared cache) before any content exists.

Callers can use this to suppress restoring the previously saved view state for files not being loaded from a database, since a saved layout would reference content that isn’t available on reopening.

Source

pub fn load_settings_for_data(&self, data: &BinaryView) -> Option<Ref<Settings>>

Trait Implementations§

Source§

impl Clone for BinaryViewType

Source§

fn clone(&self) -> BinaryViewType

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl CoreArrayProvider for BinaryViewType

Source§

impl Debug for BinaryViewType

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for BinaryViewType

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for BinaryViewType

Source§

fn eq(&self, other: &BinaryViewType) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for BinaryViewType

Source§

impl Eq for BinaryViewType

Source§

impl Send for BinaryViewType

Source§

impl StructuralPartialEq for BinaryViewType

Source§

impl Sync for BinaryViewType

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit #126799)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more