blob: 14ce7a3aa6cfee5b93ae66e5cf236e4bf7792bda [file] [log] [blame]
Alex Deymoaea4c1c2015-08-19 20:24:43 -07001//
2// Copyright (C) 2014 The Android Open Source Project
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15//
Alex Deymobb019fe2014-02-03 20:12:17 -080016
Gilad Arnold48415f12014-06-27 07:10:58 -070017#ifndef UPDATE_ENGINE_UPDATE_MANAGER_REAL_RANDOM_PROVIDER_H_
18#define UPDATE_ENGINE_UPDATE_MANAGER_REAL_RANDOM_PROVIDER_H_
Alex Deymobb019fe2014-02-03 20:12:17 -080019
Ben Chan02f7c1d2014-10-18 15:18:02 -070020#include <memory>
Alex Deymo1f012912014-04-24 19:08:04 -070021
Alex Deymo63784a52014-05-28 10:46:14 -070022#include "update_engine/update_manager/random_provider.h"
Alex Deymobb019fe2014-02-03 20:12:17 -080023
Alex Deymo63784a52014-05-28 10:46:14 -070024namespace chromeos_update_manager {
Alex Deymobb019fe2014-02-03 20:12:17 -080025
26// RandomProvider implementation class.
27class RealRandomProvider : public RandomProvider {
28 public:
29 RealRandomProvider() {}
30
Alex Vakulenko157fe302014-08-11 15:59:58 -070031 Variable<uint64_t>* var_seed() override { return var_seed_.get(); }
Alex Deymobb019fe2014-02-03 20:12:17 -080032
Alex Deymo42c30c32014-04-24 18:41:18 -070033 // Initializes the provider and returns whether it succeeded.
34 bool Init();
David Zeuthen21716e22014-04-23 15:42:05 -070035
Alex Deymo42c30c32014-04-24 18:41:18 -070036 private:
David Zeuthen21716e22014-04-23 15:42:05 -070037 // The seed() scoped variable.
Ben Chan02f7c1d2014-10-18 15:18:02 -070038 std::unique_ptr<Variable<uint64_t>> var_seed_;
David Zeuthen21716e22014-04-23 15:42:05 -070039
Alex Deymobb019fe2014-02-03 20:12:17 -080040 DISALLOW_COPY_AND_ASSIGN(RealRandomProvider);
41};
42
Alex Deymo63784a52014-05-28 10:46:14 -070043} // namespace chromeos_update_manager
Alex Deymobb019fe2014-02-03 20:12:17 -080044
Gilad Arnold48415f12014-06-27 07:10:58 -070045#endif // UPDATE_ENGINE_UPDATE_MANAGER_REAL_RANDOM_PROVIDER_H_