1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//! Set the index of the last consumed entry in the `YubiHSM2` audit log.
//! Useful in conjunction with the force audit option, which blocks performing
//! audited HSM operations until audit data has been consumed from the device.
//!
//! <https://developers.yubico.com/YubiHSM2/Commands/Set_Log_Index.html>
use super::{Command, CommandType, Response};
use adapter::Adapter;
use session::{Session, SessionError};
/// Set the index of the last consumed index of the `YubiHSM2` audit log
pub fn set_log_index<A: Adapter>(
session: &mut Session<A>,
log_index: u16,
) -> Result<(), SessionError> {
session.send_command(SetLogIndexCommand { log_index })?;
Ok(())
}
/// Request parameters for `command::set_log_index`
#[derive(Serialize, Deserialize, Debug)]
pub(crate) struct SetLogIndexCommand {
/// Index of the last log entry seen
pub log_index: u16,
}
impl Command for SetLogIndexCommand {
type ResponseType = SetLogIndexResponse;
}
/// Response from `command::set_log_index`
#[derive(Serialize, Deserialize, Debug)]
pub(crate) struct SetLogIndexResponse {}
impl Response for SetLogIndexResponse {
const COMMAND_TYPE: CommandType = CommandType::SetLogIndex;
}