Client

Struct Client 

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

Tokio-based asynchronous client API.

This is the default mode (feature async). A tokio-based IPMI v2.0 RMCP+ client.

Implementations§

Source§

impl Client

Source

pub fn builder(target: SocketAddr) -> ClientBuilder

Create a ClientBuilder.

Examples found in repository?
examples/tokio_get_device_id.rs (line 16)
8    pub async fn main() -> Result<(), Box<dyn std::error::Error>> {
9        // Example:
10        //   cargo run --example tokio_get_device_id -- 192.168.1.10:623 admin password
11        let mut args = std::env::args().skip(1);
12        let target = args.next().ok_or("missing <host:port>")?.parse()?;
13        let username = args.next().ok_or("missing <username>")?;
14        let password = args.next().ok_or("missing <password>")?;
15
16        let client = Client::builder(target)
17            .username(username)
18            .password(password)
19            .privilege_level(PrivilegeLevel::Administrator)
20            .timeout(Duration::from_secs(2))
21            .retries(3)
22            .build()
23            .await?;
24
25        let device_id = client.get_device_id().await?;
26        println!("Device: {device_id:?}");
27
28        Ok(())
29    }
Source

pub async fn execute<C: Command>(&self, command: C) -> Result<C::Output>

Execute a typed command (single request/response).

Source

pub async fn send_raw( &self, netfn: u8, cmd: u8, data: &[u8], ) -> Result<RawResponse>

Send a raw IPMI request and return the raw response.

Source

pub async fn get_device_id(&self) -> Result<DeviceId>

Convenience wrapper for Get Device ID (App NetFn, cmd 0x01).

Examples found in repository?
examples/tokio_get_device_id.rs (line 25)
8    pub async fn main() -> Result<(), Box<dyn std::error::Error>> {
9        // Example:
10        //   cargo run --example tokio_get_device_id -- 192.168.1.10:623 admin password
11        let mut args = std::env::args().skip(1);
12        let target = args.next().ok_or("missing <host:port>")?.parse()?;
13        let username = args.next().ok_or("missing <username>")?;
14        let password = args.next().ok_or("missing <password>")?;
15
16        let client = Client::builder(target)
17            .username(username)
18            .password(password)
19            .privilege_level(PrivilegeLevel::Administrator)
20            .timeout(Duration::from_secs(2))
21            .retries(3)
22            .build()
23            .await?;
24
25        let device_id = client.get_device_id().await?;
26        println!("Device: {device_id:?}");
27
28        Ok(())
29    }
Source

pub async fn get_self_test_results(&self) -> Result<SelfTestResult>

Convenience wrapper for Get Self Test Results (App NetFn, cmd 0x04).

Source

pub async fn get_system_guid(&self) -> Result<SystemGuid>

Convenience wrapper for Get System GUID (App NetFn, cmd 0x37).

Source

pub async fn get_chassis_status(&self) -> Result<ChassisStatus>

Convenience wrapper for Get Chassis Status (Chassis NetFn, cmd 0x01).

Source

pub async fn chassis_control(&self, control: ChassisControl) -> Result<()>

Run Chassis Control (Chassis NetFn, cmd 0x02).

Source

pub async fn get_channel_auth_capabilities( &self, channel: u8, privilege: PrivilegeLevel, ) -> Result<ChannelAuthCapabilities>

Convenience wrapper for Get Channel Authentication Capabilities (App NetFn, cmd 0x38).

Source

pub fn managed_session_id(&self) -> u32

Return the managed system (BMC) session ID (SIDC).

Source

pub fn remote_session_id(&self) -> u32

Return the remote console session ID (SIDM).

Source

pub async fn close_session(&self) -> Result<()>

Close the active RMCP+ session (App NetFn, cmd 0x3C).

This is a best-effort operation. If the BMC does not respond (timeout) the client still transitions to a locally closed state and will reject further requests.

Source

pub fn app(&self) -> AppService

A service-style grouping for App netfn commands.

Source

pub fn chassis(&self) -> ChassisService

A service-style grouping for Chassis netfn commands.

Trait Implementations§

Source§

impl Clone for Client

Source§

fn clone(&self) -> Client

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

Auto Trait Implementations§

§

impl Freeze for Client

§

impl !RefUnwindSafe for Client

§

impl Send for Client

§

impl Sync for Client

§

impl Unpin for Client

§

impl !UnwindSafe for Client

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)
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.

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> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V