USBGuard
Software framework that protects your computer against rogue USB devices by implementing basic whitelisting and blacklisting capabilities.
|
Represents USB interface. More...
#include <USB.hpp>
Public Member Functions | |
USBInterfaceType () | |
Constructs new interface by setting everything to zero. | |
USBInterfaceType (uint8_t bClass, uint8_t bSubClass, uint8_t bProtocol, uint8_t mask=MatchAll) | |
Constructs new interface with given class, subclass, protocol and mask. More... | |
USBInterfaceType (const USBInterfaceDescriptor &descriptor, uint8_t mask=MatchAll) | |
Constructs new interface from existing interface descriptor and sets mask. More... | |
USBInterfaceType (const std::string &type_string) | |
Constructs new interface from a string. More... | |
bool | operator== (const USBInterfaceType &rhs) const |
Compares two interfaces for equality. More... | |
bool | appliesTo (const USBInterfaceType &rhs) const |
Checks whether non-masked parts of interface match rhs interface. More... | |
const std::string | typeString () const |
Returns string representation of interface. More... | |
const std::string | toRuleString () const |
Returns string representation of interface. More... | |
Static Public Member Functions | |
static const std::string | typeString (uint8_t bClass, uint8_t bSubClass, uint8_t bProtocol, uint8_t mask=MatchAll) |
Returns string representation of interface. More... | |
Represents USB interface.
Format: three 8b numbers separated by a colon, where first number represents interface class, second number represents interface subclass and third number represents interface protocol.
Example: ff:ff:ff
usbguard::USBInterfaceType::USBInterfaceType | ( | uint8_t | bClass, |
uint8_t | bSubClass, | ||
uint8_t | bProtocol, | ||
uint8_t | mask = MatchAll |
||
) |
Constructs new interface with given class, subclass, protocol and mask.
Mask by default masks everything.
bClass | Interface mask. |
bSubClass | Interface subclass. |
bProtocol | Interface protocol. |
mask | Interface mask. |
usbguard::USBInterfaceType::USBInterfaceType | ( | const USBInterfaceDescriptor & | descriptor, |
uint8_t | mask = MatchAll |
||
) |
Constructs new interface from existing interface descriptor and sets mask.
Mask by default masks everything.
descriptor | Interface descriptor. |
mask | Interface mask. |
usbguard::USBInterfaceType::USBInterfaceType | ( | const std::string & | type_string | ) |
Constructs new interface from a string.
runtime_error | If string is not in the correct interface format. |
bool usbguard::USBInterfaceType::appliesTo | ( | const USBInterfaceType & | rhs | ) | const |
Checks whether non-masked parts of interface match rhs interface.
rhs | Interface to compare with. |
bool usbguard::USBInterfaceType::operator== | ( | const USBInterfaceType & | rhs | ) | const |
Compares two interfaces for equality.
Interfaces are equal if they have the same class, subclass, protocol and mask.
rhs | Interface to compare with. |
const std::string usbguard::USBInterfaceType::toRuleString | ( | ) | const |
Returns string representation of interface.
Synonym for typeString().
const std::string usbguard::USBInterfaceType::typeString | ( | ) | const |
Returns string representation of interface.
Internally calls static version of typeString().
|
static |
Returns string representation of interface.
Masked parts of interface are exchanged with *
.
Example: 00:*:*
bClass | Interface class. |
bSubClass | Interface subclass. |
bProtocol | Interface protocol. |
mask | Interface mask, default value is to mask everything. |