#[os]Expand description
Creates a memflow os plugin. This function takes care of supplying all necessary underlying structures for exposing a memflow os plugin in the form of a dylib.
Macro Parameters:
name - The name of the plugin
version - The version of the plugin
description - Short description of the plugin
help_fn - Name of the function that provides a help text to the user
accept_input - Wether or not this Os-Plugin is able to accept a connector as an input
return_wrapped - Wether or not the return value is an already wrapped cglue object or if the macro needs to construct it
Examples:
Simple usage:
ⓘ
#[os(name = "dummy_os", version = "1.0.0", description = "Dummy Plugin for Testing purposes")]
pub fn create_os(
_args: &OsArgs,
) -> Result<DummyOs> {
let phys_mem = DummyMemory::new(size::mb(16));
Ok(DummyOs::new(phys_mem))
}
Custom help function:
ⓘ
#[os(name = "dummy_os", help_fn = "help")]
pub fn create_os(
_args: &OsArgs,
) -> Result<DummyOs> {
let phys_mem = DummyMemory::new(size::mb(16));
Ok(DummyOs::new(phys_mem))
}
pub fn help() -> String {
"Dummy Plugin for Testing purposes".to_string()
}Wrapped return with manually created os instance:
ⓘ
#[os(name = "dummy_os", return_wrapped = true)]
pub fn create_os(
args: &OsArgs,
lib: LibArc,
) -> Result<OsInstanceArcBox<'static>> {
let phys_mem = DummyMemory::new(size::mb(16));
let os = DummyOs::new(phys_mem);
Ok(memflow::plugins::os::create_instance(os, lib, args))
}Os with input parameter:
ⓘ
#[os(name = "dummy_os", accept_input = true)]
pub fn create_os(
args: &OsArgs,
_connector: Option<ConnectorInstanceArcBox<'static>>,
) -> Result<DummyOs> {
let phys_mem = DummyMemory::new(size::mb(16));
Ok(DummyOs::new(phys_mem))
}Os with input parameter and manually created os instance:
ⓘ
#[os(name = "dummy_os", accept_input = true, return_wrapped = true)]
pub fn create_os(
args: &OsArgs,
_connector: Option<ConnectorInstanceArcBox<'static>>,
lib: LibArc,
) -> Result<OsInstanceArcBox<'static>> {
let phys_mem = DummyMemory::new(size::mb(16));
let os = DummyOs::new(phys_mem);
Ok(memflow::plugins::os::create_instance(os, lib, args))
}