blob: a5d76f13083ee74bce1f8515e717594a5334361d [file] [log] [blame]
Alex Deymoca0aaa62014-01-06 10:39:58 -08001// Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
Gilad Arnold2cbb3852014-03-07 12:40:50 -08005#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_RANDOM_PROVIDER_H_
6#define CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_RANDOM_PROVIDER_H_
Alex Deymoca0aaa62014-01-06 10:39:58 -08007
Alex Deymobb019fe2014-02-03 20:12:17 -08008#include <base/memory/scoped_ptr.h>
9
Alex Deymo6e97bb22014-02-05 16:46:16 -080010#include "update_engine/policy_manager/provider.h"
11#include "update_engine/policy_manager/variable.h"
Alex Deymoca0aaa62014-01-06 10:39:58 -080012
13namespace chromeos_policy_manager {
14
15// Provider of random values.
Gilad Arnoldb33e1982014-01-27 14:46:27 -080016class RandomProvider : public Provider {
Alex Deymoca0aaa62014-01-06 10:39:58 -080017 public:
David Zeuthen21716e22014-04-23 15:42:05 -070018 virtual ~RandomProvider() {}
19
Alex Deymobb019fe2014-02-03 20:12:17 -080020 // Return a random number every time it is requested. Note that values
21 // returned by the variables are cached by the EvaluationContext, so the
22 // returned value will be the same during the same policy request. If more
23 // random values are needed use a PRNG seeded with this value.
David Zeuthen21716e22014-04-23 15:42:05 -070024 virtual Variable<uint64_t>* var_seed() = 0;
Alex Deymoca0aaa62014-01-06 10:39:58 -080025
Gilad Arnoldb33e1982014-01-27 14:46:27 -080026 protected:
Alex Deymobb019fe2014-02-03 20:12:17 -080027 RandomProvider() {}
28
Alex Deymoca0aaa62014-01-06 10:39:58 -080029 private:
Alex Deymoca0aaa62014-01-06 10:39:58 -080030 DISALLOW_COPY_AND_ASSIGN(RandomProvider);
31};
32
33} // namespace chromeos_policy_manager
34
Gilad Arnold2cbb3852014-03-07 12:40:50 -080035#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_RANDOM_PROVIDER_H_