blob: 1a63b2d14494867a94da699f08c6cabe1106f560 [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 Deymo6e97bb22014-02-05 16:46:16 -08008#include "update_engine/policy_manager/provider.h"
9#include "update_engine/policy_manager/variable.h"
Alex Deymoca0aaa62014-01-06 10:39:58 -080010
11namespace chromeos_policy_manager {
12
13// Provider of random values.
Gilad Arnoldb33e1982014-01-27 14:46:27 -080014class RandomProvider : public Provider {
Alex Deymoca0aaa62014-01-06 10:39:58 -080015 public:
David Zeuthen21716e22014-04-23 15:42:05 -070016 virtual ~RandomProvider() {}
17
Alex Deymobb019fe2014-02-03 20:12:17 -080018 // Return a random number every time it is requested. Note that values
19 // returned by the variables are cached by the EvaluationContext, so the
20 // returned value will be the same during the same policy request. If more
21 // random values are needed use a PRNG seeded with this value.
David Zeuthen21716e22014-04-23 15:42:05 -070022 virtual Variable<uint64_t>* var_seed() = 0;
Alex Deymoca0aaa62014-01-06 10:39:58 -080023
Gilad Arnoldb33e1982014-01-27 14:46:27 -080024 protected:
Alex Deymobb019fe2014-02-03 20:12:17 -080025 RandomProvider() {}
26
Alex Deymoca0aaa62014-01-06 10:39:58 -080027 private:
Alex Deymoca0aaa62014-01-06 10:39:58 -080028 DISALLOW_COPY_AND_ASSIGN(RandomProvider);
29};
30
31} // namespace chromeos_policy_manager
32
Gilad Arnold2cbb3852014-03-07 12:40:50 -080033#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_RANDOM_PROVIDER_H_