blob: dcbf696f50b0970849eb728d07c30fd69272f126 [file] [log] [blame]
// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <string>
#include <base/macros.h>
#include "permission_broker/rule.h"
struct udev;
namespace permission_broker {
// DenyClaimedUsbDeviceRule encapsulates the policy that any USB device that is
// claimed by a driver is |DENY|'d, while all other requests are |IGNORE|'d. It
// does this by walking the udev device tree (the entire tree, not just the USB
// subsystem) and attempts, for each device entry, to find a parent device
// within the USB subsystem whose device node property is the same as the |path|
// parameter. If such a matching device exists, the path is rejected as it has
// been demonstrated to be claimed by another udev entry.
class DenyClaimedUsbDeviceRule : public Rule {
~DenyClaimedUsbDeviceRule() override;
Result Process(const std::string &path, const int interface_id) override;
struct udev *const udev_;
} // namespace permission_broker