shill: vpn: Use Mapped custom accessor for properties
VPN services simply ask their drivers to populate their PropertyStore.
VPN drivers use CustomMapped accessors to make their KeyValueStore
available.
BUG=chromium-os:28303,chromium-os:28223
TEST=New unit tests
Change-Id: I05a4f2c09ddd03b40b947274fd38572da5d6dbdc
Reviewed-on: https://gerrit.chromium.org/gerrit/18989
Commit-Ready: Paul Stewart <pstew@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
diff --git a/openvpn_driver.h b/openvpn_driver.h
index 374258b..91a9ff6 100644
--- a/openvpn_driver.h
+++ b/openvpn_driver.h
@@ -55,6 +55,13 @@
virtual bool Load(StoreInterface *storage, const std::string &storage_id);
virtual bool Save(StoreInterface *storage, const std::string &storage_id);
+ virtual void InitPropertyStore(PropertyStore *store);
+ void ClearMappedProperty(const size_t &index, Error *error);
+ std::string GetMappedProperty(const size_t &index, Error *error);
+ void SetMappedProperty(const size_t &index,
+ const std::string &value,
+ Error *error);
+
private:
friend class OpenVPNDriverTest;
FRIEND_TEST(OpenVPNDriverTest, AppendFlag);
@@ -79,8 +86,14 @@
FRIEND_TEST(OpenVPNDriverTest, SpawnOpenVPN);
FRIEND_TEST(OpenVPNDriverTest, VerifyPaths);
+ struct Property {
+ const char *property;
+ bool crypted;
+ };
+
static const char kOpenVPNPath[];
static const char kOpenVPNScript[];
+ static const Property kProperties[];
// The map is a sorted container that allows us to iterate through the options
// in order.