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
impl Client
Sourcepub fn builder(target: SocketAddr) -> ClientBuilder
pub fn builder(target: SocketAddr) -> ClientBuilder
Create a ClientBuilder.
Examples found in repository?
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 }Sourcepub async fn execute<C: Command>(&self, command: C) -> Result<C::Output>
pub async fn execute<C: Command>(&self, command: C) -> Result<C::Output>
Execute a typed command (single request/response).
Sourcepub async fn send_raw(
&self,
netfn: u8,
cmd: u8,
data: &[u8],
) -> Result<RawResponse>
pub async fn send_raw( &self, netfn: u8, cmd: u8, data: &[u8], ) -> Result<RawResponse>
Send a raw IPMI request and return the raw response.
Sourcepub async fn get_device_id(&self) -> Result<DeviceId>
pub async fn get_device_id(&self) -> Result<DeviceId>
Convenience wrapper for Get Device ID (App NetFn, cmd 0x01).
Examples found in repository?
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 }Sourcepub async fn get_self_test_results(&self) -> Result<SelfTestResult>
pub async fn get_self_test_results(&self) -> Result<SelfTestResult>
Convenience wrapper for Get Self Test Results (App NetFn, cmd 0x04).
Sourcepub async fn get_system_guid(&self) -> Result<SystemGuid>
pub async fn get_system_guid(&self) -> Result<SystemGuid>
Convenience wrapper for Get System GUID (App NetFn, cmd 0x37).
Sourcepub async fn get_chassis_status(&self) -> Result<ChassisStatus>
pub async fn get_chassis_status(&self) -> Result<ChassisStatus>
Convenience wrapper for Get Chassis Status (Chassis NetFn, cmd 0x01).
Sourcepub async fn chassis_control(&self, control: ChassisControl) -> Result<()>
pub async fn chassis_control(&self, control: ChassisControl) -> Result<()>
Run Chassis Control (Chassis NetFn, cmd 0x02).
Sourcepub async fn get_channel_auth_capabilities(
&self,
channel: u8,
privilege: PrivilegeLevel,
) -> Result<ChannelAuthCapabilities>
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).
Sourcepub fn managed_session_id(&self) -> u32
pub fn managed_session_id(&self) -> u32
Return the managed system (BMC) session ID (SIDC).
Sourcepub fn remote_session_id(&self) -> u32
pub fn remote_session_id(&self) -> u32
Return the remote console session ID (SIDM).
Sourcepub async fn close_session(&self) -> Result<()>
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.