Paul Stewart | 20088d8 | 2012-02-16 06:58:55 -0800 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium OS Authors. All rights reserved. |
Paul Stewart | fdd1607 | 2011-09-16 12:41:35 -0700 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef SHILL_TECHNOLOGY_ |
| 6 | #define SHILL_TECHNOLOGY_ |
| 7 | |
| 8 | #include <string> |
Paul Stewart | 20088d8 | 2012-02-16 06:58:55 -0800 | [diff] [blame] | 9 | #include <vector> |
Paul Stewart | fdd1607 | 2011-09-16 12:41:35 -0700 | [diff] [blame] | 10 | |
| 11 | namespace shill { |
| 12 | |
Paul Stewart | 20088d8 | 2012-02-16 06:58:55 -0800 | [diff] [blame] | 13 | class Error; |
| 14 | |
Paul Stewart | fdd1607 | 2011-09-16 12:41:35 -0700 | [diff] [blame] | 15 | class Technology { |
| 16 | public: |
| 17 | enum Identifier { |
| 18 | kEthernet, |
| 19 | kWifi, |
Paul Stewart | 2001a42 | 2011-12-15 10:20:09 -0800 | [diff] [blame] | 20 | kWiFiMonitor, |
Paul Stewart | fdd1607 | 2011-09-16 12:41:35 -0700 | [diff] [blame] | 21 | kCellular, |
| 22 | kBlacklisted, |
| 23 | kUnknown, |
Paul Stewart | fdd1607 | 2011-09-16 12:41:35 -0700 | [diff] [blame] | 24 | }; |
| 25 | |
| 26 | static Identifier IdentifierFromName(const std::string &name); |
| 27 | static std::string NameFromIdentifier(Identifier id); |
Paul Stewart | 1b25314 | 2012-01-26 14:05:52 -0800 | [diff] [blame] | 28 | static Identifier IdentifierFromStorageGroup(const std::string &group); |
Paul Stewart | fdd1607 | 2011-09-16 12:41:35 -0700 | [diff] [blame] | 29 | |
Paul Stewart | 20088d8 | 2012-02-16 06:58:55 -0800 | [diff] [blame] | 30 | // Convert the comma-separated list of technology names in |
| 31 | // |technologies_string| into a vector of technology identifiers output in |
| 32 | // |technologies_vector|. Returns true if the |technologies_string| contains |
| 33 | // a valid set of technologies with no duplicate elements, false otherwise. |
| 34 | static bool GetTechnologyVectorFromString( |
| 35 | const std::string &technologies_string, |
| 36 | std::vector<Identifier> *technologies_vector, |
| 37 | Error *error); |
| 38 | |
Paul Stewart | fdd1607 | 2011-09-16 12:41:35 -0700 | [diff] [blame] | 39 | private: |
| 40 | static const char kUnknownName[]; |
| 41 | }; |
| 42 | |
| 43 | } // namespace shill |
| 44 | |
| 45 | #endif // SHILL_TECHNOLOGY_ |