⚠️ VeridianOS Kernel Documentation - This is low-level kernel code. All functions are unsafe unless explicitly marked otherwise. no_std

IscsiInitiator

Struct IscsiInitiator 

Source
pub struct IscsiInitiator { /* private fields */ }
Expand description

iSCSI initiator.

Implementations§

Source§

impl IscsiInitiator

Source

pub fn new(portal: &str) -> Self

Create a new iSCSI initiator.

Source

pub fn login( &mut self, initiator_name: &str, target_name: &str, ) -> Result<usize, IscsiError>

Perform login to a target.

Source

pub fn logout(&mut self, session_idx: usize) -> Result<(), IscsiError>

Logout from a session.

Source

pub fn scsi_command( &mut self, session_idx: usize, cmd: &ScsiCommand, write_data: Option<&[u8]>, ) -> Result<ScsiResponse, IscsiError>

Send a SCSI command and receive response.

Source

pub fn inquiry( &mut self, session_idx: usize, lun: u64, ) -> Result<InquiryData, IscsiError>

Send INQUIRY command.

Source

pub fn read_capacity( &mut self, session_idx: usize, lun: u64, ) -> Result<DiskCapacity, IscsiError>

Send READ CAPACITY (10) command.

Source

pub fn read_blocks( &mut self, session_idx: usize, lun: u64, lba: u32, block_count: u16, block_size: u32, ) -> Result<Vec<u8>, IscsiError>

Read blocks from target.

Source

pub fn write_blocks( &mut self, session_idx: usize, lun: u64, lba: u32, block_count: u16, block_size: u32, data: &[u8], ) -> Result<(), IscsiError>

Write blocks to target.

Source

pub fn discovery( &mut self, session_idx: usize, ) -> Result<Vec<String>, IscsiError>

Discover targets via SendTargets text request.

Source

pub fn build_pdu(&self, bhs: &BhsHeader, data: &[u8]) -> Vec<u8>

Build a complete iSCSI PDU from BHS and data segment.

Source

pub fn parse_pdu(&self, data: &[u8]) -> Result<(BhsHeader, Vec<u8>), IscsiError>

Parse a PDU from raw bytes.

Source

pub fn build_operational_params(&self) -> Vec<u8>

Build operational parameter negotiation text.

Source

pub fn portal(&self) -> &str

Get the target portal address.

Source

pub fn session_count(&self) -> usize

Get the number of active sessions.

Source

pub fn session(&self, idx: usize) -> Option<&IscsiSession>

Get a session by index.

Auto Trait Implementations§

§

impl Freeze for IscsiInitiator

§

impl RefUnwindSafe for IscsiInitiator

§

impl Send for IscsiInitiator

§

impl Sync for IscsiInitiator

§

impl Unpin for IscsiInitiator

§

impl UnwindSafe for IscsiInitiator

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.