blob: 00eced7381963708b1b0234b042c43eee59cbfa3 [file] [log] [blame]
mukesh agrawal4d0401c2012-01-06 16:05:31 -08001// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
Chris Masoneb925cc82011-06-22 15:39:57 -07002// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "shill/property_store.h"
6
7#include <map>
8#include <string>
9#include <vector>
10
Eric Shienbrood3e20a232012-02-16 11:35:56 -050011#include <base/stl_util.h>
Chris Masoneb925cc82011-06-22 15:39:57 -070012
13#include "shill/error.h"
Christopher Wileyb691efd2012-08-09 13:51:51 -070014#include "shill/logging.h"
Chris Masoneb925cc82011-06-22 15:39:57 -070015#include "shill/property_accessor.h"
16
17using std::map;
18using std::string;
19using std::vector;
20
21namespace shill {
22
Rebecca Silbersteinc9c31d82014-10-21 15:01:00 -070023namespace Logging {
24static auto kModuleLogScope = ScopeLogger::kProperty;
Paul Stewart1a212a62015-06-16 13:13:10 -070025static string ObjectID(const PropertyStore* p) { return "(property_store)"; }
Rebecca Silbersteinc9c31d82014-10-21 15:01:00 -070026}
27
Chris Masoneb925cc82011-06-22 15:39:57 -070028PropertyStore::PropertyStore() {}
29
mukesh agrawalbebf1b82013-04-23 15:06:33 -070030PropertyStore::PropertyStore(PropertyChangeCallback on_property_changed) :
31 property_changed_callback_(on_property_changed) {}
32
Chris Masoneb925cc82011-06-22 15:39:57 -070033PropertyStore::~PropertyStore() {}
34
Paul Stewart1a212a62015-06-16 13:13:10 -070035bool PropertyStore::Contains(const string& prop) const {
mukesh agrawal66b0aca2012-01-30 15:28:28 -080036 return (ContainsKey(bool_properties_, prop) ||
37 ContainsKey(int16_properties_, prop) ||
38 ContainsKey(int32_properties_, prop) ||
39 ContainsKey(key_value_store_properties_, prop) ||
40 ContainsKey(string_properties_, prop) ||
41 ContainsKey(stringmap_properties_, prop) ||
42 ContainsKey(stringmaps_properties_, prop) ||
43 ContainsKey(strings_properties_, prop) ||
44 ContainsKey(uint8_properties_, prop) ||
45 ContainsKey(uint16_properties_, prop) ||
mukesh agrawale7c7e652013-06-18 17:19:39 -070046 ContainsKey(uint16s_properties_, prop) ||
Jason Glasgowacdc11f2012-03-30 14:12:22 -040047 ContainsKey(uint32_properties_, prop) ||
Paul Stewarte18c33b2012-07-10 20:48:44 -070048 ContainsKey(uint64_properties_, prop) ||
Jason Glasgowacdc11f2012-03-30 14:12:22 -040049 ContainsKey(rpc_identifier_properties_, prop) ||
50 ContainsKey(rpc_identifiers_properties_, prop));
Chris Masoneb925cc82011-06-22 15:39:57 -070051}
52
Paul Stewart1a212a62015-06-16 13:13:10 -070053bool PropertyStore::GetBoolProperty(const string& name,
54 bool* value,
55 Error* error) const {
Paul Stewarte6e8e492013-01-17 11:00:50 -080056 return GetProperty(name, value, error, bool_properties_, "a bool");
57}
58
Paul Stewart1a212a62015-06-16 13:13:10 -070059bool PropertyStore::GetInt16Property(const string& name,
60 int16_t* value,
61 Error* error) const {
Ben Chan7fab8972014-08-10 17:14:46 -070062 return GetProperty(name, value, error, int16_properties_, "an int16_t");
Paul Stewarte6e8e492013-01-17 11:00:50 -080063}
64
Paul Stewart1a212a62015-06-16 13:13:10 -070065bool PropertyStore::GetInt32Property(const string& name,
66 int32_t* value,
67 Error* error) const {
Ben Chan7fab8972014-08-10 17:14:46 -070068 return GetProperty(name, value, error, int32_properties_, "an int32_t");
Paul Stewarte6e8e492013-01-17 11:00:50 -080069}
70
Paul Stewart1a212a62015-06-16 13:13:10 -070071bool PropertyStore::GetKeyValueStoreProperty(const string& name,
72 KeyValueStore* value,
73 Error* error) const {
Paul Stewarte6e8e492013-01-17 11:00:50 -080074 return GetProperty(name, value, error, key_value_store_properties_,
75 "a key value store");
76}
77
Paul Stewart1a212a62015-06-16 13:13:10 -070078bool PropertyStore::GetRpcIdentifierProperty(const string& name,
79 RpcIdentifier* value,
80 Error* error) const {
Paul Stewarte6e8e492013-01-17 11:00:50 -080081 return GetProperty(name, value, error, rpc_identifier_properties_,
82 "an rpc_identifier");
83}
84
Paul Stewart1a212a62015-06-16 13:13:10 -070085bool PropertyStore::GetStringProperty(const string& name,
86 string* value,
87 Error* error) const {
Paul Stewarte6e8e492013-01-17 11:00:50 -080088 return GetProperty(name, value, error, string_properties_, "a string");
89}
90
Paul Stewart1a212a62015-06-16 13:13:10 -070091bool PropertyStore::GetStringmapProperty(const string& name,
92 Stringmap* values,
93 Error* error) const {
Paul Stewarte6e8e492013-01-17 11:00:50 -080094 return GetProperty(name, values, error, stringmap_properties_,
95 "a string map");
96}
97
Paul Stewart1a212a62015-06-16 13:13:10 -070098bool PropertyStore::GetStringmapsProperty(const string& name,
99 Stringmaps* values,
100 Error* error) const {
Paul Stewarte6e8e492013-01-17 11:00:50 -0800101 return GetProperty(name, values, error, stringmaps_properties_,
102 "a string map list");
103}
104
Paul Stewart1a212a62015-06-16 13:13:10 -0700105bool PropertyStore::GetStringsProperty(const string& name,
106 Strings* values,
107 Error* error) const {
Paul Stewarte6e8e492013-01-17 11:00:50 -0800108 return GetProperty(name, values, error, strings_properties_, "a string list");
109}
110
Paul Stewart1a212a62015-06-16 13:13:10 -0700111bool PropertyStore::GetUint8Property(const string& name,
112 uint8_t* value,
113 Error* error) const {
Ben Chan7fab8972014-08-10 17:14:46 -0700114 return GetProperty(name, value, error, uint8_properties_, "a uint8_t");
Paul Stewarte6e8e492013-01-17 11:00:50 -0800115}
116
Paul Stewart1a212a62015-06-16 13:13:10 -0700117bool PropertyStore::GetUint16Property(const string& name,
118 uint16_t* value,
119 Error* error) const {
Ben Chan7fab8972014-08-10 17:14:46 -0700120 return GetProperty(name, value, error, uint16_properties_, "a uint16_t");
Paul Stewarte6e8e492013-01-17 11:00:50 -0800121}
122
Paul Stewart1a212a62015-06-16 13:13:10 -0700123bool PropertyStore::GetUint16sProperty(const string& name,
124 Uint16s* value,
125 Error* error) const {
Ben Chan7fab8972014-08-10 17:14:46 -0700126 return GetProperty(name, value, error, uint16s_properties_,
127 "a uint16_t list");
mukesh agrawale7c7e652013-06-18 17:19:39 -0700128}
129
Paul Stewart1a212a62015-06-16 13:13:10 -0700130bool PropertyStore::GetUint32Property(const string& name,
131 uint32_t* value,
132 Error* error) const {
Ben Chan7fab8972014-08-10 17:14:46 -0700133 return GetProperty(name, value, error, uint32_properties_, "a uint32_t");
Paul Stewarte6e8e492013-01-17 11:00:50 -0800134}
135
Paul Stewart1a212a62015-06-16 13:13:10 -0700136bool PropertyStore::GetUint64Property(const string& name,
137 uint64_t* value,
138 Error* error) const {
Ben Chan7fab8972014-08-10 17:14:46 -0700139 return GetProperty(name, value, error, uint64_properties_, "a uint64_t");
Paul Stewarte6e8e492013-01-17 11:00:50 -0800140}
141
Paul Stewart1a212a62015-06-16 13:13:10 -0700142bool PropertyStore::SetBoolProperty(const string& name,
Chris Masoneb925cc82011-06-22 15:39:57 -0700143 bool value,
Paul Stewart1a212a62015-06-16 13:13:10 -0700144 Error* error) {
Alex Vakulenko8a532292014-06-16 17:18:44 -0700145 return SetProperty(name, value, error, &bool_properties_, "a bool");
Chris Masoneb925cc82011-06-22 15:39:57 -0700146}
147
Paul Stewart1a212a62015-06-16 13:13:10 -0700148bool PropertyStore::SetInt16Property(const string& name,
Ben Chan7fab8972014-08-10 17:14:46 -0700149 int16_t value,
Paul Stewart1a212a62015-06-16 13:13:10 -0700150 Error* error) {
Ben Chan7fab8972014-08-10 17:14:46 -0700151 return SetProperty(name, value, error, &int16_properties_, "an int16_t");
Chris Masoneb925cc82011-06-22 15:39:57 -0700152}
153
Paul Stewart1a212a62015-06-16 13:13:10 -0700154bool PropertyStore::SetInt32Property(const string& name,
Ben Chan7fab8972014-08-10 17:14:46 -0700155 int32_t value,
Paul Stewart1a212a62015-06-16 13:13:10 -0700156 Error* error) {
Ben Chan7fab8972014-08-10 17:14:46 -0700157 return SetProperty(name, value, error, &int32_properties_, "an int32_t.");
Chris Masoneb925cc82011-06-22 15:39:57 -0700158}
159
Paul Stewart1a212a62015-06-16 13:13:10 -0700160bool PropertyStore::SetKeyValueStoreProperty(const string& name,
161 const KeyValueStore& value,
162 Error* error) {
Peter Qiu08bf5082014-09-08 15:57:12 -0700163 return SetProperty(name, value, error, &key_value_store_properties_,
164 "a key value store");
165}
166
Paul Stewart1a212a62015-06-16 13:13:10 -0700167bool PropertyStore::SetStringProperty(const string& name,
168 const string& value,
169 Error* error) {
Alex Vakulenko8a532292014-06-16 17:18:44 -0700170 return SetProperty(name, value, error, &string_properties_, "a string");
Chris Masoneb925cc82011-06-22 15:39:57 -0700171}
172
Paul Stewart1a212a62015-06-16 13:13:10 -0700173bool PropertyStore::SetStringmapProperty(const string& name,
174 const map<string, string>& values,
175 Error* error) {
Alex Vakulenko8a532292014-06-16 17:18:44 -0700176 return SetProperty(name, values, error, &stringmap_properties_,
mukesh agrawalffa3d042011-10-06 15:26:10 -0700177 "a string map");
Chris Masoneb925cc82011-06-22 15:39:57 -0700178}
179
mukesh agrawalbebf1b82013-04-23 15:06:33 -0700180bool PropertyStore::SetStringmapsProperty(
Paul Stewart1a212a62015-06-16 13:13:10 -0700181 const string& name,
182 const vector<map<string, string>>& values,
183 Error* error) {
Alex Vakulenko8a532292014-06-16 17:18:44 -0700184 return SetProperty(name, values, error, &stringmaps_properties_,
mukesh agrawalbebf1b82013-04-23 15:06:33 -0700185 "a stringmaps");
186}
187
Paul Stewart1a212a62015-06-16 13:13:10 -0700188bool PropertyStore::SetStringsProperty(const string& name,
189 const vector<string>& values,
190 Error* error) {
Alex Vakulenko8a532292014-06-16 17:18:44 -0700191 return SetProperty(name, values, error, &strings_properties_,
192 "a string list");
Chris Masoneb925cc82011-06-22 15:39:57 -0700193}
194
Paul Stewart1a212a62015-06-16 13:13:10 -0700195bool PropertyStore::SetUint8Property(const string& name,
Ben Chan7fab8972014-08-10 17:14:46 -0700196 uint8_t value,
Paul Stewart1a212a62015-06-16 13:13:10 -0700197 Error* error) {
Ben Chan7fab8972014-08-10 17:14:46 -0700198 return SetProperty(name, value, error, &uint8_properties_, "a uint8_t");
Chris Masoneb925cc82011-06-22 15:39:57 -0700199}
200
Paul Stewart1a212a62015-06-16 13:13:10 -0700201bool PropertyStore::SetUint16Property(const string& name,
Ben Chan7fab8972014-08-10 17:14:46 -0700202 uint16_t value,
Paul Stewart1a212a62015-06-16 13:13:10 -0700203 Error* error) {
Ben Chan7fab8972014-08-10 17:14:46 -0700204 return SetProperty(name, value, error, &uint16_properties_, "a uint16_t");
Chris Masoneb925cc82011-06-22 15:39:57 -0700205}
206
Paul Stewart1a212a62015-06-16 13:13:10 -0700207bool PropertyStore::SetUint16sProperty(const string& name,
208 const vector<uint16_t>& value,
209 Error* error) {
Ben Chan7fab8972014-08-10 17:14:46 -0700210 return SetProperty(name, value, error, &uint16s_properties_,
211 "a uint16_t list");
mukesh agrawale7c7e652013-06-18 17:19:39 -0700212}
213
Paul Stewart1a212a62015-06-16 13:13:10 -0700214bool PropertyStore::SetUint32Property(const string& name,
Ben Chan7fab8972014-08-10 17:14:46 -0700215 uint32_t value,
Paul Stewart1a212a62015-06-16 13:13:10 -0700216 Error* error) {
Ben Chan7fab8972014-08-10 17:14:46 -0700217 return SetProperty(name, value, error, &uint32_properties_, "a uint32_t");
Chris Masoneb925cc82011-06-22 15:39:57 -0700218}
219
Paul Stewart1a212a62015-06-16 13:13:10 -0700220bool PropertyStore::SetUint64Property(const string& name,
Ben Chan7fab8972014-08-10 17:14:46 -0700221 uint64_t value,
Paul Stewart1a212a62015-06-16 13:13:10 -0700222 Error* error) {
Ben Chan7fab8972014-08-10 17:14:46 -0700223 return SetProperty(name, value, error, &uint64_properties_, "a uint64_t");
Paul Stewarte18c33b2012-07-10 20:48:44 -0700224}
225
Paul Stewart1a212a62015-06-16 13:13:10 -0700226bool PropertyStore::SetRpcIdentifierProperty(const string& name,
227 const RpcIdentifier& value,
228 Error* error) {
Alex Vakulenko8a532292014-06-16 17:18:44 -0700229 return SetProperty(name, value, error, &rpc_identifier_properties_,
Jason Glasgowacdc11f2012-03-30 14:12:22 -0400230 "an rpc_identifier");
231}
232
Paul Stewart1a212a62015-06-16 13:13:10 -0700233bool PropertyStore::ClearProperty(const string& name, Error* error) {
Rebecca Silbersteinc9c31d82014-10-21 15:01:00 -0700234 SLOG(this, 2) << "Clearing " << name << ".";
mukesh agrawal4d260da2012-01-30 11:53:52 -0800235
236 if (ContainsKey(bool_properties_, name)) {
237 bool_properties_[name]->Clear(error);
238 } else if (ContainsKey(int16_properties_, name)) {
239 int16_properties_[name]->Clear(error);
240 } else if (ContainsKey(int32_properties_, name)) {
241 int32_properties_[name]->Clear(error);
242 } else if (ContainsKey(key_value_store_properties_, name)) {
243 key_value_store_properties_[name]->Clear(error);
244 } else if (ContainsKey(string_properties_, name)) {
245 string_properties_[name]->Clear(error);
246 } else if (ContainsKey(stringmap_properties_, name)) {
247 stringmap_properties_[name]->Clear(error);
248 } else if (ContainsKey(stringmaps_properties_, name)) {
249 stringmaps_properties_[name]->Clear(error);
250 } else if (ContainsKey(strings_properties_, name)) {
251 strings_properties_[name]->Clear(error);
252 } else if (ContainsKey(uint8_properties_, name)) {
253 uint8_properties_[name]->Clear(error);
254 } else if (ContainsKey(uint16_properties_, name)) {
255 uint16_properties_[name]->Clear(error);
mukesh agrawale7c7e652013-06-18 17:19:39 -0700256 } else if (ContainsKey(uint16s_properties_, name)) {
257 uint16s_properties_[name]->Clear(error);
mukesh agrawal4d260da2012-01-30 11:53:52 -0800258 } else if (ContainsKey(uint32_properties_, name)) {
259 uint32_properties_[name]->Clear(error);
Paul Stewarte18c33b2012-07-10 20:48:44 -0700260 } else if (ContainsKey(uint64_properties_, name)) {
261 uint64_properties_[name]->Clear(error);
Jason Glasgowacdc11f2012-03-30 14:12:22 -0400262 } else if (ContainsKey(rpc_identifier_properties_, name)) {
263 rpc_identifier_properties_[name]->Clear(error);
264 } else if (ContainsKey(rpc_identifiers_properties_, name)) {
265 rpc_identifiers_properties_[name]->Clear(error);
mukesh agrawal4d260da2012-01-30 11:53:52 -0800266 } else {
267 error->Populate(
268 Error::kInvalidProperty, "Property " + name + " does not exist.");
269 }
mukesh agrawalbebf1b82013-04-23 15:06:33 -0700270 if (error->IsSuccess()) {
271 if (!property_changed_callback_.is_null()) {
272 property_changed_callback_.Run(name);
273 }
274 }
mukesh agrawal4d260da2012-01-30 11:53:52 -0800275 return error->IsSuccess();
276}
277
Gaurav Shah1b7a6162011-11-09 11:41:01 -0800278ReadablePropertyConstIterator<bool> PropertyStore::GetBoolPropertiesIter()
mukesh agrawalde29fa82011-09-16 16:16:36 -0700279 const {
Gaurav Shah1b7a6162011-11-09 11:41:01 -0800280 return ReadablePropertyConstIterator<bool>(bool_properties_);
Chris Masonea8a2c252011-06-27 22:16:30 -0700281}
282
Ben Chan7fab8972014-08-10 17:14:46 -0700283ReadablePropertyConstIterator<int16_t> PropertyStore::GetInt16PropertiesIter()
mukesh agrawalde29fa82011-09-16 16:16:36 -0700284 const {
Ben Chan7fab8972014-08-10 17:14:46 -0700285 return ReadablePropertyConstIterator<int16_t>(int16_properties_);
Chris Masonea8a2c252011-06-27 22:16:30 -0700286}
287
Ben Chan7fab8972014-08-10 17:14:46 -0700288ReadablePropertyConstIterator<int32_t> PropertyStore::GetInt32PropertiesIter()
mukesh agrawalde29fa82011-09-16 16:16:36 -0700289 const {
Ben Chan7fab8972014-08-10 17:14:46 -0700290 return ReadablePropertyConstIterator<int32_t>(int32_properties_);
Chris Masone889666b2011-07-03 12:58:50 -0700291}
292
Darin Petkov63138a92012-02-06 14:09:15 +0100293ReadablePropertyConstIterator<KeyValueStore>
294PropertyStore::GetKeyValueStorePropertiesIter() const {
295 return
296 ReadablePropertyConstIterator<KeyValueStore>(key_value_store_properties_);
297}
298
Jason Glasgowacdc11f2012-03-30 14:12:22 -0400299ReadablePropertyConstIterator<RpcIdentifier>
300PropertyStore::GetRpcIdentifierPropertiesIter() const {
301 return ReadablePropertyConstIterator<RpcIdentifier>(
302 rpc_identifier_properties_);
303}
304
mukesh agrawal2366eed2012-03-20 18:21:50 -0700305ReadablePropertyConstIterator<RpcIdentifiers>
306PropertyStore::GetRpcIdentifiersPropertiesIter() const {
307 return ReadablePropertyConstIterator<RpcIdentifiers>(
308 rpc_identifiers_properties_);
309}
310
mukesh agrawal66b0aca2012-01-30 15:28:28 -0800311ReadablePropertyConstIterator<string>
Gaurav Shah1b7a6162011-11-09 11:41:01 -0800312PropertyStore::GetStringPropertiesIter() const {
mukesh agrawal66b0aca2012-01-30 15:28:28 -0800313 return ReadablePropertyConstIterator<string>(string_properties_);
Chris Masonea8a2c252011-06-27 22:16:30 -0700314}
315
Gaurav Shah1b7a6162011-11-09 11:41:01 -0800316ReadablePropertyConstIterator<Stringmap>
317PropertyStore::GetStringmapPropertiesIter() const {
318 return ReadablePropertyConstIterator<Stringmap>(stringmap_properties_);
Chris Masonea8a2c252011-06-27 22:16:30 -0700319}
320
Gaurav Shah1b7a6162011-11-09 11:41:01 -0800321ReadablePropertyConstIterator<Stringmaps>
322PropertyStore::GetStringmapsPropertiesIter()
323 const {
324 return ReadablePropertyConstIterator<Stringmaps>(stringmaps_properties_);
325}
326
327ReadablePropertyConstIterator<Strings> PropertyStore::GetStringsPropertiesIter()
328 const {
329 return ReadablePropertyConstIterator<Strings>(strings_properties_);
330}
331
Ben Chan7fab8972014-08-10 17:14:46 -0700332ReadablePropertyConstIterator<uint8_t> PropertyStore::GetUint8PropertiesIter()
Gaurav Shah1b7a6162011-11-09 11:41:01 -0800333 const {
Ben Chan7fab8972014-08-10 17:14:46 -0700334 return ReadablePropertyConstIterator<uint8_t>(uint8_properties_);
Gaurav Shah1b7a6162011-11-09 11:41:01 -0800335}
336
Ben Chan7fab8972014-08-10 17:14:46 -0700337ReadablePropertyConstIterator<uint16_t> PropertyStore::GetUint16PropertiesIter()
Gaurav Shah1b7a6162011-11-09 11:41:01 -0800338 const {
Ben Chan7fab8972014-08-10 17:14:46 -0700339 return ReadablePropertyConstIterator<uint16_t>(uint16_properties_);
Gaurav Shah1b7a6162011-11-09 11:41:01 -0800340}
341
mukesh agrawale7c7e652013-06-18 17:19:39 -0700342ReadablePropertyConstIterator<Uint16s> PropertyStore::GetUint16sPropertiesIter()
343 const {
344 return ReadablePropertyConstIterator<Uint16s>(uint16s_properties_);
345}
346
Ben Chan7fab8972014-08-10 17:14:46 -0700347ReadablePropertyConstIterator<uint32_t> PropertyStore::GetUint32PropertiesIter()
Gaurav Shah1b7a6162011-11-09 11:41:01 -0800348 const {
Ben Chan7fab8972014-08-10 17:14:46 -0700349 return ReadablePropertyConstIterator<uint32_t>(uint32_properties_);
Chris Masonea8a2c252011-06-27 22:16:30 -0700350}
351
Ben Chan7fab8972014-08-10 17:14:46 -0700352ReadablePropertyConstIterator<uint64_t> PropertyStore::GetUint64PropertiesIter()
Paul Stewarte18c33b2012-07-10 20:48:44 -0700353 const {
Ben Chan7fab8972014-08-10 17:14:46 -0700354 return ReadablePropertyConstIterator<uint64_t>(uint64_properties_);
Paul Stewarte18c33b2012-07-10 20:48:44 -0700355}
356
Paul Stewart1a212a62015-06-16 13:13:10 -0700357void PropertyStore::RegisterBool(const string& name, bool* prop) {
mukesh agrawal4d260da2012-01-30 11:53:52 -0800358 DCHECK(!Contains(name) || ContainsKey(bool_properties_, name))
359 << "(Already registered " << name << ")";
Chris Masoneb925cc82011-06-22 15:39:57 -0700360 bool_properties_[name] = BoolAccessor(new PropertyAccessor<bool>(prop));
361}
362
Paul Stewart1a212a62015-06-16 13:13:10 -0700363void PropertyStore::RegisterConstBool(const string& name, const bool* prop) {
mukesh agrawal4d260da2012-01-30 11:53:52 -0800364 DCHECK(!Contains(name) || ContainsKey(bool_properties_, name))
365 << "(Already registered " << name << ")";
Chris Masoneb925cc82011-06-22 15:39:57 -0700366 bool_properties_[name] = BoolAccessor(new ConstPropertyAccessor<bool>(prop));
367}
368
Paul Stewart1a212a62015-06-16 13:13:10 -0700369void PropertyStore::RegisterWriteOnlyBool(const string& name, bool* prop) {
mukesh agrawal4d260da2012-01-30 11:53:52 -0800370 DCHECK(!Contains(name) || ContainsKey(bool_properties_, name))
371 << "(Already registered " << name << ")";
Gaurav Shah1b7a6162011-11-09 11:41:01 -0800372 bool_properties_[name] = BoolAccessor(
373 new WriteOnlyPropertyAccessor<bool>(prop));
374}
375
Paul Stewart1a212a62015-06-16 13:13:10 -0700376void PropertyStore::RegisterInt16(const string& name, int16_t* prop) {
mukesh agrawal4d260da2012-01-30 11:53:52 -0800377 DCHECK(!Contains(name) || ContainsKey(int16_properties_, name))
378 << "(Already registered " << name << ")";
Ben Chan7fab8972014-08-10 17:14:46 -0700379 int16_properties_[name] = Int16Accessor(new PropertyAccessor<int16_t>(prop));
Chris Masoneb925cc82011-06-22 15:39:57 -0700380}
381
Paul Stewart1a212a62015-06-16 13:13:10 -0700382void PropertyStore::RegisterConstInt16(const string& name,
383 const int16_t* prop) {
mukesh agrawal4d260da2012-01-30 11:53:52 -0800384 DCHECK(!Contains(name) || ContainsKey(int16_properties_, name))
385 << "(Already registered " << name << ")";
Chris Masoneb925cc82011-06-22 15:39:57 -0700386 int16_properties_[name] =
Ben Chan7fab8972014-08-10 17:14:46 -0700387 Int16Accessor(new ConstPropertyAccessor<int16_t>(prop));
Chris Masoneb925cc82011-06-22 15:39:57 -0700388}
389
Paul Stewart1a212a62015-06-16 13:13:10 -0700390void PropertyStore::RegisterWriteOnlyInt16(const string& name, int16_t* prop) {
mukesh agrawal4d260da2012-01-30 11:53:52 -0800391 DCHECK(!Contains(name) || ContainsKey(int16_properties_, name))
392 << "(Already registered " << name << ")";
Gaurav Shah1b7a6162011-11-09 11:41:01 -0800393 int16_properties_[name] =
Ben Chan7fab8972014-08-10 17:14:46 -0700394 Int16Accessor(new WriteOnlyPropertyAccessor<int16_t>(prop));
Gaurav Shah1b7a6162011-11-09 11:41:01 -0800395}
Paul Stewart1a212a62015-06-16 13:13:10 -0700396void PropertyStore::RegisterInt32(const string& name, int32_t* prop) {
mukesh agrawal4d260da2012-01-30 11:53:52 -0800397 DCHECK(!Contains(name) || ContainsKey(int32_properties_, name))
398 << "(Already registered " << name << ")";
Ben Chan7fab8972014-08-10 17:14:46 -0700399 int32_properties_[name] = Int32Accessor(new PropertyAccessor<int32_t>(prop));
Chris Masoneb925cc82011-06-22 15:39:57 -0700400}
401
Paul Stewart1a212a62015-06-16 13:13:10 -0700402void PropertyStore::RegisterConstInt32(const string& name,
403 const int32_t* prop) {
mukesh agrawal4d260da2012-01-30 11:53:52 -0800404 DCHECK(!Contains(name) || ContainsKey(int32_properties_, name))
405 << "(Already registered " << name << ")";
Chris Masoneb925cc82011-06-22 15:39:57 -0700406 int32_properties_[name] =
Ben Chan7fab8972014-08-10 17:14:46 -0700407 Int32Accessor(new ConstPropertyAccessor<int32_t>(prop));
Chris Masoneb925cc82011-06-22 15:39:57 -0700408}
409
Paul Stewart1a212a62015-06-16 13:13:10 -0700410void PropertyStore::RegisterWriteOnlyInt32(const string& name, int32_t* prop) {
mukesh agrawal4d260da2012-01-30 11:53:52 -0800411 DCHECK(!Contains(name) || ContainsKey(int32_properties_, name))
412 << "(Already registered " << name << ")";
Gaurav Shah1b7a6162011-11-09 11:41:01 -0800413 int32_properties_[name] =
Ben Chan7fab8972014-08-10 17:14:46 -0700414 Int32Accessor(new WriteOnlyPropertyAccessor<int32_t>(prop));
Gaurav Shah1b7a6162011-11-09 11:41:01 -0800415}
416
Paul Stewart1a212a62015-06-16 13:13:10 -0700417void PropertyStore::RegisterString(const string& name, string* prop) {
mukesh agrawal4d260da2012-01-30 11:53:52 -0800418 DCHECK(!Contains(name) || ContainsKey(string_properties_, name))
419 << "(Already registered " << name << ")";
Chris Masoneb925cc82011-06-22 15:39:57 -0700420 string_properties_[name] = StringAccessor(new PropertyAccessor<string>(prop));
421}
422
Paul Stewart1a212a62015-06-16 13:13:10 -0700423void PropertyStore::RegisterConstString(const string& name,
424 const string* prop) {
mukesh agrawal4d260da2012-01-30 11:53:52 -0800425 DCHECK(!Contains(name) || ContainsKey(string_properties_, name))
426 << "(Already registered " << name << ")";
Chris Masoneb925cc82011-06-22 15:39:57 -0700427 string_properties_[name] =
428 StringAccessor(new ConstPropertyAccessor<string>(prop));
429}
430
Paul Stewart1a212a62015-06-16 13:13:10 -0700431void PropertyStore::RegisterWriteOnlyString(const string& name, string* prop) {
mukesh agrawal4d260da2012-01-30 11:53:52 -0800432 DCHECK(!Contains(name) || ContainsKey(string_properties_, name))
433 << "(Already registered " << name << ")";
Gaurav Shah1b7a6162011-11-09 11:41:01 -0800434 string_properties_[name] =
435 StringAccessor(new WriteOnlyPropertyAccessor<string>(prop));
436}
437
Paul Stewart1a212a62015-06-16 13:13:10 -0700438void PropertyStore::RegisterStringmap(const string& name, Stringmap* prop) {
mukesh agrawal4d260da2012-01-30 11:53:52 -0800439 DCHECK(!Contains(name) || ContainsKey(stringmap_properties_, name))
440 << "(Already registered " << name << ")";
Chris Masoneb925cc82011-06-22 15:39:57 -0700441 stringmap_properties_[name] =
Chris Masone43b48a12011-07-01 13:37:07 -0700442 StringmapAccessor(new PropertyAccessor<Stringmap>(prop));
Chris Masoneb925cc82011-06-22 15:39:57 -0700443}
444
Paul Stewart1a212a62015-06-16 13:13:10 -0700445void PropertyStore::RegisterConstStringmap(const string& name,
446 const Stringmap* prop) {
mukesh agrawal4d260da2012-01-30 11:53:52 -0800447 DCHECK(!Contains(name) || ContainsKey(stringmap_properties_, name))
448 << "(Already registered " << name << ")";
Chris Masoneb925cc82011-06-22 15:39:57 -0700449 stringmap_properties_[name] =
Chris Masone43b48a12011-07-01 13:37:07 -0700450 StringmapAccessor(new ConstPropertyAccessor<Stringmap>(prop));
451}
452
Paul Stewart1a212a62015-06-16 13:13:10 -0700453void PropertyStore::RegisterWriteOnlyStringmap(const string& name,
454 Stringmap* prop) {
mukesh agrawal4d260da2012-01-30 11:53:52 -0800455 DCHECK(!Contains(name) || ContainsKey(stringmap_properties_, name))
456 << "(Already registered " << name << ")";
Gaurav Shah1b7a6162011-11-09 11:41:01 -0800457 stringmap_properties_[name] =
458 StringmapAccessor(new WriteOnlyPropertyAccessor<Stringmap>(prop));
459}
460
Paul Stewart1a212a62015-06-16 13:13:10 -0700461void PropertyStore::RegisterStringmaps(const string& name, Stringmaps* prop) {
mukesh agrawal4d260da2012-01-30 11:53:52 -0800462 DCHECK(!Contains(name) || ContainsKey(stringmaps_properties_, name))
463 << "(Already registered " << name << ")";
Darin Petkovc0865312011-09-16 15:31:20 -0700464 stringmaps_properties_[name] =
465 StringmapsAccessor(new PropertyAccessor<Stringmaps>(prop));
466}
467
Paul Stewart1a212a62015-06-16 13:13:10 -0700468void PropertyStore::RegisterConstStringmaps(const string& name,
469 const Stringmaps* prop) {
mukesh agrawal4d260da2012-01-30 11:53:52 -0800470 DCHECK(!Contains(name) || ContainsKey(stringmaps_properties_, name))
471 << "(Already registered " << name << ")";
Darin Petkovc0865312011-09-16 15:31:20 -0700472 stringmaps_properties_[name] =
473 StringmapsAccessor(new ConstPropertyAccessor<Stringmaps>(prop));
474}
475
Paul Stewart1a212a62015-06-16 13:13:10 -0700476void PropertyStore::RegisterWriteOnlyStringmaps(const string& name,
477 Stringmaps* prop) {
mukesh agrawal4d260da2012-01-30 11:53:52 -0800478 DCHECK(!Contains(name) || ContainsKey(stringmaps_properties_, name))
479 << "(Already registered " << name << ")";
Gaurav Shah1b7a6162011-11-09 11:41:01 -0800480 stringmaps_properties_[name] =
481 StringmapsAccessor(new WriteOnlyPropertyAccessor<Stringmaps>(prop));
482}
483
Paul Stewart1a212a62015-06-16 13:13:10 -0700484void PropertyStore::RegisterStrings(const string& name, Strings* prop) {
mukesh agrawal4d260da2012-01-30 11:53:52 -0800485 DCHECK(!Contains(name) || ContainsKey(strings_properties_, name))
486 << "(Already registered " << name << ")";
Chris Masone43b48a12011-07-01 13:37:07 -0700487 strings_properties_[name] =
488 StringsAccessor(new PropertyAccessor<Strings>(prop));
Chris Masoneb925cc82011-06-22 15:39:57 -0700489}
490
Paul Stewart1a212a62015-06-16 13:13:10 -0700491void PropertyStore::RegisterConstStrings(const string& name,
492 const Strings* prop) {
mukesh agrawal4d260da2012-01-30 11:53:52 -0800493 DCHECK(!Contains(name) || ContainsKey(strings_properties_, name))
494 << "(Already registered " << name << ")";
Chris Masone889666b2011-07-03 12:58:50 -0700495 strings_properties_[name] =
496 StringsAccessor(new ConstPropertyAccessor<Strings>(prop));
497}
498
Paul Stewart1a212a62015-06-16 13:13:10 -0700499void PropertyStore::RegisterWriteOnlyStrings(const string& name,
500 Strings* prop) {
mukesh agrawal4d260da2012-01-30 11:53:52 -0800501 DCHECK(!Contains(name) || ContainsKey(strings_properties_, name))
502 << "(Already registered " << name << ")";
Gaurav Shah1b7a6162011-11-09 11:41:01 -0800503 strings_properties_[name] =
504 StringsAccessor(new WriteOnlyPropertyAccessor<Strings>(prop));
505}
506
Paul Stewart1a212a62015-06-16 13:13:10 -0700507void PropertyStore::RegisterUint8(const string& name, uint8_t* prop) {
mukesh agrawal4d260da2012-01-30 11:53:52 -0800508 DCHECK(!Contains(name) || ContainsKey(uint8_properties_, name))
509 << "(Already registered " << name << ")";
Ben Chan7fab8972014-08-10 17:14:46 -0700510 uint8_properties_[name] = Uint8Accessor(new PropertyAccessor<uint8_t>(prop));
Chris Masone889666b2011-07-03 12:58:50 -0700511}
512
Paul Stewart1a212a62015-06-16 13:13:10 -0700513void PropertyStore::RegisterConstUint8(const string& name,
514 const uint8_t* prop) {
mukesh agrawal4d260da2012-01-30 11:53:52 -0800515 DCHECK(!Contains(name) || ContainsKey(uint8_properties_, name))
516 << "(Already registered " << name << ")";
Chris Masoneb925cc82011-06-22 15:39:57 -0700517 uint8_properties_[name] =
Ben Chan7fab8972014-08-10 17:14:46 -0700518 Uint8Accessor(new ConstPropertyAccessor<uint8_t>(prop));
Chris Masoneb925cc82011-06-22 15:39:57 -0700519}
520
Paul Stewart1a212a62015-06-16 13:13:10 -0700521void PropertyStore::RegisterWriteOnlyUint8(const string& name, uint8_t* prop) {
mukesh agrawal4d260da2012-01-30 11:53:52 -0800522 DCHECK(!Contains(name) || ContainsKey(uint8_properties_, name))
523 << "(Already registered " << name << ")";
Gaurav Shah1b7a6162011-11-09 11:41:01 -0800524 uint8_properties_[name] =
Ben Chan7fab8972014-08-10 17:14:46 -0700525 Uint8Accessor(new WriteOnlyPropertyAccessor<uint8_t>(prop));
Gaurav Shah1b7a6162011-11-09 11:41:01 -0800526}
527
Paul Stewart1a212a62015-06-16 13:13:10 -0700528void PropertyStore::RegisterUint16(const string& name, uint16_t* prop) {
mukesh agrawal4d260da2012-01-30 11:53:52 -0800529 DCHECK(!Contains(name) || ContainsKey(uint16_properties_, name))
530 << "(Already registered " << name << ")";
Ben Chan7fab8972014-08-10 17:14:46 -0700531 uint16_properties_[name] =
532 Uint16Accessor(new PropertyAccessor<uint16_t>(prop));
Chris Masoneb925cc82011-06-22 15:39:57 -0700533}
534
Paul Stewart1a212a62015-06-16 13:13:10 -0700535void PropertyStore::RegisterUint16s(const string& name, Uint16s* prop) {
mukesh agrawale7c7e652013-06-18 17:19:39 -0700536 DCHECK(!Contains(name) || ContainsKey(uint16s_properties_, name))
537 << "(Already registered " << name << ")";
538 uint16s_properties_[name] =
539 Uint16sAccessor(new PropertyAccessor<Uint16s>(prop));
540}
541
Paul Stewart1a212a62015-06-16 13:13:10 -0700542void PropertyStore::RegisterUint32(const std::string& name, uint32_t* prop) {
mukesh agrawal4d260da2012-01-30 11:53:52 -0800543 DCHECK(!Contains(name) || ContainsKey(uint32_properties_, name))
544 << "(Already registered " << name << ")";
Ben Chan7fab8972014-08-10 17:14:46 -0700545 uint32_properties_[name] =
546 Uint32Accessor(new PropertyAccessor<uint32_t>(prop));
mukesh agrawal4d260da2012-01-30 11:53:52 -0800547}
548
Paul Stewart1a212a62015-06-16 13:13:10 -0700549void PropertyStore::RegisterConstUint16(const string& name,
550 const uint16_t* prop) {
mukesh agrawal4d260da2012-01-30 11:53:52 -0800551 DCHECK(!Contains(name) || ContainsKey(uint16_properties_, name))
552 << "(Already registered " << name << ")";
Chris Masoneb925cc82011-06-22 15:39:57 -0700553 uint16_properties_[name] =
Ben Chan7fab8972014-08-10 17:14:46 -0700554 Uint16Accessor(new ConstPropertyAccessor<uint16_t>(prop));
Chris Masoneb925cc82011-06-22 15:39:57 -0700555}
556
Paul Stewart1a212a62015-06-16 13:13:10 -0700557void PropertyStore::RegisterConstUint16s(const string& name,
558 const Uint16s* prop) {
mukesh agrawale7c7e652013-06-18 17:19:39 -0700559 DCHECK(!Contains(name) || ContainsKey(uint16s_properties_, name))
560 << "(Already registered " << name << ")";
561 uint16s_properties_[name] =
562 Uint16sAccessor(new ConstPropertyAccessor<Uint16s>(prop));
563}
564
Paul Stewart1a212a62015-06-16 13:13:10 -0700565void PropertyStore::RegisterWriteOnlyUint16(const string& name,
566 uint16_t* prop) {
mukesh agrawal4d260da2012-01-30 11:53:52 -0800567 DCHECK(!Contains(name) || ContainsKey(uint16_properties_, name))
568 << "(Already registered " << name << ")";
Gaurav Shah1b7a6162011-11-09 11:41:01 -0800569 uint16_properties_[name] =
Ben Chan7fab8972014-08-10 17:14:46 -0700570 Uint16Accessor(new WriteOnlyPropertyAccessor<uint16_t>(prop));
Gaurav Shah1b7a6162011-11-09 11:41:01 -0800571}
572
Paul Stewart1a212a62015-06-16 13:13:10 -0700573void PropertyStore::RegisterDerivedBool(const string& name,
574 const BoolAccessor& accessor) {
mukesh agrawal4d260da2012-01-30 11:53:52 -0800575 DCHECK(!Contains(name) || ContainsKey(bool_properties_, name))
576 << "(Already registered " << name << ")";
Chris Masone27c4aa52011-07-02 13:10:14 -0700577 bool_properties_[name] = accessor;
578}
579
Paul Stewart1a212a62015-06-16 13:13:10 -0700580void PropertyStore::RegisterDerivedInt32(const string& name,
581 const Int32Accessor& accessor) {
mukesh agrawal4d260da2012-01-30 11:53:52 -0800582 DCHECK(!Contains(name) || ContainsKey(int32_properties_, name))
583 << "(Already registered " << name << ")";
mukesh agrawal4d0401c2012-01-06 16:05:31 -0800584 int32_properties_[name] = accessor;
585}
586
Darin Petkov63138a92012-02-06 14:09:15 +0100587void PropertyStore::RegisterDerivedKeyValueStore(
Paul Stewart1a212a62015-06-16 13:13:10 -0700588 const string& name,
589 const KeyValueStoreAccessor& acc) {
mukesh agrawal4d260da2012-01-30 11:53:52 -0800590 DCHECK(!Contains(name) || ContainsKey(key_value_store_properties_, name))
591 << "(Already registered " << name << ")";
Darin Petkov63138a92012-02-06 14:09:15 +0100592 key_value_store_properties_[name] = acc;
593}
594
Jason Glasgowacdc11f2012-03-30 14:12:22 -0400595void PropertyStore::RegisterDerivedRpcIdentifier(
Paul Stewart1a212a62015-06-16 13:13:10 -0700596 const string& name,
597 const RpcIdentifierAccessor& acc) {
Jason Glasgowacdc11f2012-03-30 14:12:22 -0400598 DCHECK(!Contains(name) || ContainsKey(rpc_identifier_properties_, name))
599 << "(Already registered " << name << ")";
600 rpc_identifier_properties_[name] = acc;
601}
602
mukesh agrawal2366eed2012-03-20 18:21:50 -0700603void PropertyStore::RegisterDerivedRpcIdentifiers(
Paul Stewart1a212a62015-06-16 13:13:10 -0700604 const string& name,
605 const RpcIdentifiersAccessor& accessor) {
mukesh agrawal2366eed2012-03-20 18:21:50 -0700606 DCHECK(!Contains(name) || ContainsKey(rpc_identifiers_properties_, name))
607 << "(Already registered " << name << ")";
608 rpc_identifiers_properties_[name] = accessor;
609}
610
Paul Stewart1a212a62015-06-16 13:13:10 -0700611void PropertyStore::RegisterDerivedString(const string& name,
612 const StringAccessor& accessor) {
mukesh agrawal4d260da2012-01-30 11:53:52 -0800613 DCHECK(!Contains(name) || ContainsKey(string_properties_, name))
614 << "(Already registered " << name << ")";
Chris Masone27c4aa52011-07-02 13:10:14 -0700615 string_properties_[name] = accessor;
616}
617
Paul Stewart1a212a62015-06-16 13:13:10 -0700618void PropertyStore::RegisterDerivedStrings(const string& name,
619 const StringsAccessor& accessor) {
mukesh agrawal4d260da2012-01-30 11:53:52 -0800620 DCHECK(!Contains(name) || ContainsKey(strings_properties_, name))
621 << "(Already registered " << name << ")";
Chris Masone27c4aa52011-07-02 13:10:14 -0700622 strings_properties_[name] = accessor;
Chris Masoneb925cc82011-06-22 15:39:57 -0700623}
624
Paul Stewart1a212a62015-06-16 13:13:10 -0700625void PropertyStore::RegisterDerivedStringmap(const string& name,
626 const StringmapAccessor& acc) {
Eric Shienbrood30bc0ec2012-03-21 18:19:46 -0400627 DCHECK(!Contains(name) || ContainsKey(stringmap_properties_, name))
628 << "(Already registered " << name << ")";
629 stringmap_properties_[name] = acc;
630}
631
Paul Stewart1a212a62015-06-16 13:13:10 -0700632void PropertyStore::RegisterDerivedStringmaps(const string& name,
633 const StringmapsAccessor& acc) {
mukesh agrawal4d260da2012-01-30 11:53:52 -0800634 DCHECK(!Contains(name) || ContainsKey(stringmaps_properties_, name))
635 << "(Already registered " << name << ")";
Chris Masone889666b2011-07-03 12:58:50 -0700636 stringmaps_properties_[name] = acc;
637}
638
Paul Stewart1a212a62015-06-16 13:13:10 -0700639void PropertyStore::RegisterDerivedUint16(const string& name,
640 const Uint16Accessor& acc) {
mukesh agrawal4d260da2012-01-30 11:53:52 -0800641 DCHECK(!Contains(name) || ContainsKey(uint16_properties_, name))
642 << "(Already registered " << name << ")";
Paul Stewartbe5f5b32011-12-07 17:11:11 -0800643 uint16_properties_[name] = acc;
644}
645
Paul Stewart1a212a62015-06-16 13:13:10 -0700646void PropertyStore::RegisterDerivedUint64(const string& name,
647 const Uint64Accessor& acc) {
Paul Stewarte18c33b2012-07-10 20:48:44 -0700648 DCHECK(!Contains(name) || ContainsKey(uint64_properties_, name))
649 << "(Already registered " << name << ")";
650 uint64_properties_[name] = acc;
651}
652
mukesh agrawal66b0aca2012-01-30 15:28:28 -0800653// private methods
654
mukesh agrawalffa3d042011-10-06 15:26:10 -0700655template <class V>
Paul Stewarte6e8e492013-01-17 11:00:50 -0800656bool PropertyStore::GetProperty(
Paul Stewart1a212a62015-06-16 13:13:10 -0700657 const string& name,
658 V* value,
659 Error* error,
660 const map<string, std::shared_ptr<AccessorInterface<V>>>& collection,
661 const string& value_type_english) const {
Rebecca Silbersteinc9c31d82014-10-21 15:01:00 -0700662 SLOG(this, 2) << "Getting " << name << " as " << value_type_english
663 << ".";
Ben Chane2ee5e02014-09-19 19:29:42 -0700664 typename map<string, std::shared_ptr<AccessorInterface<V>>>::const_iterator
665 it = collection.find(name);
Paul Stewarte6e8e492013-01-17 11:00:50 -0800666 if (it != collection.end()) {
667 V val = it->second->Get(error);
668 if (error->IsSuccess()) {
669 *value = val;
670 }
671 } else {
672 if (Contains(name)) {
673 error->Populate(
674 Error::kInvalidArguments,
675 "Property " + name + " is not " + value_type_english + ".");
676 } else {
677 error->Populate(
678 Error::kInvalidProperty, "Property " + name + " does not exist.");
679 }
680 }
681 return error->IsSuccess();
Alex Vakulenko8a532292014-06-16 17:18:44 -0700682}
Paul Stewarte6e8e492013-01-17 11:00:50 -0800683
684template <class V>
mukesh agrawalffa3d042011-10-06 15:26:10 -0700685bool PropertyStore::SetProperty(
Paul Stewart1a212a62015-06-16 13:13:10 -0700686 const string& name,
687 const V& value,
688 Error* error,
Ben Chane2ee5e02014-09-19 19:29:42 -0700689 map<string, std::shared_ptr<AccessorInterface<V>>>* collection,
Paul Stewart1a212a62015-06-16 13:13:10 -0700690 const string& value_type_english) {
mukesh agrawalbebf1b82013-04-23 15:06:33 -0700691 bool ret = false;
Rebecca Silbersteinc9c31d82014-10-21 15:01:00 -0700692 SLOG(this, 2) << "Setting " << name << " as " << value_type_english
693 << ".";
Alex Vakulenko8a532292014-06-16 17:18:44 -0700694 if (ContainsKey(*collection, name)) {
695 ret = (*collection)[name]->Set(value, error);
mukesh agrawalbebf1b82013-04-23 15:06:33 -0700696 if (ret) {
697 if (!property_changed_callback_.is_null()) {
698 property_changed_callback_.Run(name);
699 }
700 }
mukesh agrawalffa3d042011-10-06 15:26:10 -0700701 } else {
702 if (Contains(name)) {
703 error->Populate(
704 Error::kInvalidArguments,
705 "Property " + name + " is not " + value_type_english + ".");
706 } else {
707 error->Populate(
708 Error::kInvalidProperty, "Property " + name + " does not exist.");
709 }
710 }
mukesh agrawalbebf1b82013-04-23 15:06:33 -0700711 return ret;
Alex Vakulenko8a532292014-06-16 17:18:44 -0700712}
mukesh agrawalffa3d042011-10-06 15:26:10 -0700713
Chris Masoneb925cc82011-06-22 15:39:57 -0700714} // namespace shill