pub struct Handle(/* private fields */);Expand description
A handle to the netlink connection, used to send and receive netlink messsage
Implementations§
Source§impl Handle
impl Handle
Sourcepub fn request(
&mut self,
message: NetlinkMessage<AuditMessage>,
) -> Result<impl Stream<Item = NetlinkMessage<AuditMessage>>, Error>
pub fn request( &mut self, message: NetlinkMessage<AuditMessage>, ) -> Result<impl Stream<Item = NetlinkMessage<AuditMessage>>, Error>
Send a netlink message, and get the reponse as a stream of messages.
Sourcepub fn list_rules(&mut self) -> impl TryStream<Ok = RuleMessage, Error = Error>
pub fn list_rules(&mut self) -> impl TryStream<Ok = RuleMessage, Error = Error>
List the current rules
Sourcepub async fn enable_events(&mut self) -> Result<(), Error>
pub async fn enable_events(&mut self) -> Result<(), Error>
Enable receiving events in this process.
This function enable events and set the PID in a single message.
This works well if done once in the process life. If however you need to
disable and enable events, you will want to call the
Handle::set_enabled and Handle::set_pid directly, so as to
handle the errors in a more granular manner.
Sourcepub async fn set_enabled(&mut self, value: bool) -> Result<(), Error>
pub async fn set_enabled(&mut self, value: bool) -> Result<(), Error>
Set whether to enable the audit daemon or not.
When enabling the audit daemon with this function, you should ensure
that you set the PID of the current process already with a call to
Handle::set_pid.
See Handle::enable_events for a more convenient helper to enable
events in a single call.
Sourcepub async fn set_pid(&mut self, pid: u32) -> Result<(), Error>
pub async fn set_pid(&mut self, pid: u32) -> Result<(), Error>
Set the PID to which audit messages should be addressed.
You probably want to use either:
- Your own pid, to receive audit events
- 0, to unset the PID restriction, for example when disabling the audit connection.
Sourcepub async fn get_status(&mut self) -> Result<StatusMessage, Error>
pub async fn get_status(&mut self) -> Result<StatusMessage, Error>
Get current audit status
Sourcepub async fn set_status(&mut self, status: StatusMessage) -> Result<(), Error>
pub async fn set_status(&mut self, status: StatusMessage) -> Result<(), Error>
Set the audit status
You must have properly set the mask field according to which fields must be set.