blob: 6000451516ca3d069ce49fbb6623d20182165708 [file] [log] [blame]
Alex Deymob3fa53b2016-04-18 19:57:58 -07001//
2// Copyright (C) 2016 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//
16
17#ifndef UPDATE_ENGINE_OMAHA_UTILS_H_
18#define UPDATE_ENGINE_OMAHA_UTILS_H_
19
20#include <string>
21
22namespace chromeos_update_engine {
23
Jae Hoon Kim893cae42019-08-16 17:13:49 -070024// The possible string values for the end-of-life status.
25extern const char kEolStatusSupported[];
26extern const char kEolStatusSecurityOnly[];
27extern const char kEolStatusEol[];
28
Alex Deymob3fa53b2016-04-18 19:57:58 -070029// The end-of-life status of the device.
30enum class EolStatus {
31 kSupported = 0,
32 kSecurityOnly,
33 kEol,
34};
35
Jae Hoon Kim893cae42019-08-16 17:13:49 -070036using MilestonesToEol = int;
37// The default milestones to EOL.
38extern const MilestonesToEol kMilestonesToEolNone;
39
Alex Deymob3fa53b2016-04-18 19:57:58 -070040// Returns the string representation of the |eol_status|.
41const char* EolStatusToString(EolStatus eol_status);
42
43// Converts the end-of-life status string to an EolStatus numeric value. In case
44// of an invalid string, the default "supported" value will be used instead.
45EolStatus StringToEolStatus(const std::string& eol_status);
46
Jae Hoon Kim893cae42019-08-16 17:13:49 -070047// Returns the string representation of the |milestones_to_eol|.
48std::string MilestonesToEolToString(int milestones_to_eol);
49
50// Converts the milestones to EOL string to an |MilestonesToEol| enum class.
51// When the milestones to EOL is not an integer, the default
52// |kMilestonesToEolNone| will be returned.
53MilestonesToEol StringToMilestonesToEol(const std::string& milestones_to_eol);
54
Alex Deymob3fa53b2016-04-18 19:57:58 -070055} // namespace chromeos_update_engine
56
57#endif // UPDATE_ENGINE_OMAHA_UTILS_H_