Allows to receive signals and to communicate with the USBGuard daemon.
More...
#include <Interface.hpp>
|
virtual std::string | setParameter (const std::string &name, const std::string &value)=0 |
| Set value of a runtime parameter. More...
|
|
virtual std::string | getParameter (const std::string &name)=0 |
| Get value of a runtime parameter. More...
|
|
virtual uint32_t | appendRule (const std::string &rule_spec, uint32_t parent_id, bool permanent)=0 |
| Append a new rule to the current policy. More...
|
|
virtual void | removeRule (uint32_t id)=0 |
| Remove a rule from the current policy. More...
|
|
virtual const std::vector< Rule > | listRules (const std::string &query)=0 |
| List the current rule set (policy) used by the USBGuard daemon. More...
|
|
virtual uint32_t | applyDevicePolicy (uint32_t id, Rule::Target target, bool permanent)=0 |
| Apply an authorization target to a device. More...
|
|
virtual const std::vector< Rule > | listDevices (const std::string &query)=0 |
| List devices that match the specified query. More...
|
|
virtual void | DevicePresenceChanged (uint32_t id, DeviceManager::EventType event, Rule::Target target, const std::string &device_rule)=0 |
| Notify that a USB device was already present when USBGuard was started. More...
|
|
virtual void | DevicePolicyChanged (uint32_t id, Rule::Target target_old, Rule::Target target_new, const std::string &device_rule, uint32_t rule_id)=0 |
| Notify about a change of a USB device authorization target. More...
|
|
virtual void | PropertyParameterChanged (const std::string &name, const std::string &value_old, const std::string &value_new)=0 |
| Notify about a change of a property parameter. More...
|
|
virtual void | ExceptionMessage (const std::string &context, const std::string &object, const std::string &reason)=0 |
| Notify about an exception. More...
|
|
Allows to receive signals and to communicate with the USBGuard daemon.
◆ appendRule()
virtual uint32_t usbguard::Interface::appendRule |
( |
const std::string & |
rule_spec, |
|
|
uint32_t |
parent_id, |
|
|
bool |
permanent |
|
) |
| |
|
pure virtual |
Append a new rule to the current policy.
Using the parent_id
parameter, the rule can be inserted anywhere in the policy, not only at the end. When the rule is successfully appended, the ID assigned to the new rule is returned.
- Parameters
-
rule_spec | The rule that should be appended to the policy. |
parent_id | Rule ID of the parent rule. |
permanent | Determines whether the rule will be added to the policy file. |
- Returns
- The rule ID assigned to the successfully appended rule.
Implemented in usbguard::IPCClient.
◆ applyDevicePolicy()
virtual uint32_t usbguard::Interface::applyDevicePolicy |
( |
uint32_t |
id, |
|
|
Rule::Target |
target, |
|
|
bool |
permanent |
|
) |
| |
|
pure virtual |
Apply an authorization target to a device.
If the permanent
flag is set to true, a rule will be appended to the policy or an existing device rule will be modified in order to permanently store the authorization decision. Successful execution of this method will cause the DevicePolicyChanged signal to be broadcasted if the device authorization target was different then the applied target.
- Parameters
-
id | Device ID of the device to authorize. |
target | Device authorization target. |
permanent | Boolean flag specifying whether an allow rule should be appended to the policy. |
- Returns
- If
permanent
was set to true, the method will return an ID of the rule that was modified or created because of this request.
Implemented in usbguard::IPCClient.
◆ DevicePolicyChanged()
virtual void usbguard::Interface::DevicePolicyChanged |
( |
uint32_t |
id, |
|
|
Rule::Target |
target_old, |
|
|
Rule::Target |
target_new, |
|
|
const std::string & |
device_rule, |
|
|
uint32_t |
rule_id |
|
) |
| |
|
pure virtual |
Notify about a change of a USB device authorization target.
The device attribute dictionary contains the following attributes:
- id (the USB device ID in the form VID:PID)
- name
- serial
- via-port
- hash
- parent-hash
- with-interface
- Parameters
-
id | ID of the device. |
target_old | Previous authorization target. |
target_new | Current authorization target. |
device_rule | Device specific rule. |
rule_id | Rule ID of the matched rule. Otherwise a reserved rule ID value is used. |
Implemented in usbguard::IPCServer, and usbguard::IPCClient.
◆ DevicePresenceChanged()
Notify that a USB device was already present when USBGuard was started.
The device attribute dictionary contains the following attributes:
- id (the USB device ID in the form VID:PID)
- name
- serial
- via-port
- hash
- parent-hash
- with-interface
The USB interface types are represented as strings of the form AA:BB:CC, where AA, BB and CC are hexadecimal numbers representing the class, subclass and protocol of the interface as defined by the USB standard.
- Parameters
-
id | ID of the device. |
event | Type of the presence change event. |
target | The current authorization target of the device. |
device_rule | Device specific rule. |
Implemented in usbguard::IPCServer, and usbguard::IPCClient.
◆ ExceptionMessage()
virtual void usbguard::Interface::ExceptionMessage |
( |
const std::string & |
context, |
|
|
const std::string & |
object, |
|
|
const std::string & |
reason |
|
) |
| |
|
pure virtual |
Notify about an exception.
- Parameters
-
context | Description or identifier of the exception context. |
object | Description or identifier of the object which caused the exception. |
reason | Reason explaining why the exception was generated. |
Implemented in usbguard::IPCServer, and usbguard::IPCClient.
◆ getParameter()
virtual std::string usbguard::Interface::getParameter |
( |
const std::string & |
name | ) |
|
|
pure virtual |
Get value of a runtime parameter.
- Parameters
-
name | Name of runtime parameter. |
- Returns
- Value of runtime parameter.
Implemented in usbguard::IPCClient.
◆ listDevices()
virtual const std::vector<Rule> usbguard::Interface::listDevices |
( |
const std::string & |
query | ) |
|
|
pure virtual |
List devices that match the specified query.
The query uses the rule language syntax and the devices are returned as device specific rules. The target in each rule represents the current authorization state of the device. Order of the returned devices is not defined and should not be relied upon.
- Parameters
-
query | Query in the rule language syntax used to match devices. |
- Returns
- Vector of device specific rules that match the query.
Implemented in usbguard::IPCClient.
◆ listRules()
virtual const std::vector<Rule> usbguard::Interface::listRules |
( |
const std::string & |
query | ) |
|
|
pure virtual |
List the current rule set (policy) used by the USBGuard daemon.
The rules are returned in the same order as they are evaluated.
- Parameters
-
query | Query used for matching rules. |
- Returns
- Vector of rules.
Implemented in usbguard::IPCClient.
◆ PropertyParameterChanged()
virtual void usbguard::Interface::PropertyParameterChanged |
( |
const std::string & |
name, |
|
|
const std::string & |
value_old, |
|
|
const std::string & |
value_new |
|
) |
| |
|
pure virtual |
Notify about a change of a property parameter.
- Parameters
-
name | Policy name. |
value_old | Previous policy value. |
value_new | Current policy value. |
Implemented in usbguard::IPCServer, and usbguard::IPCClient.
◆ removeRule()
virtual void usbguard::Interface::removeRule |
( |
uint32_t |
id | ) |
|
|
pure virtual |
Remove a rule from the current policy.
- Parameters
-
id | The rule ID of the rule to be removed. |
Implemented in usbguard::IPCClient.
◆ setParameter()
virtual std::string usbguard::Interface::setParameter |
( |
const std::string & |
name, |
|
|
const std::string & |
value |
|
) |
| |
|
pure virtual |
Set value of a runtime parameter.
- Parameters
-
name | Name of runtime parameter. |
value | Value of runtime parameter. |
- Returns
- Previous value of runtime parameter.
Implemented in usbguard::IPCClient.
The documentation for this class was generated from the following file: