shill: *Provider: Flesh out inherited classes
Implement CreateTemporaryService and FindSimilarService for all
remaining service subclasses. Now that this is done, change
Provider into a pure-virtual ProviderInterface and remove its
implementation and tests.
BUG=chromium:265592
TEST=Unit tests
Change-Id: I4b74ad7b8602d90908b7596bbbb08eddb01e1c17
Reviewed-on: https://gerrit.chromium.org/gerrit/63650
Commit-Queue: Paul Stewart <pstew@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
diff --git a/provider_interface.h b/provider_interface.h
new file mode 100644
index 0000000..5de021a
--- /dev/null
+++ b/provider_interface.h
@@ -0,0 +1,52 @@
+// Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SHILL_PROVIDER_INTERFACE_H_
+#define SHILL_PROVIDER_INTERFACE_H_
+
+#include "shill/refptr_types.h"
+
+namespace shill {
+
+class Error;
+class KeyValueStore;
+
+// This is an interface for objects that creates and manages service objects.
+class ProviderInterface {
+ public:
+ virtual ~ProviderInterface() {}
+
+ // Creates services from the entries within |profile|.
+ virtual void CreateServicesFromProfile(const ProfileRefPtr &profile) = 0;
+
+ // Finds a Service with similar properties to |args|. The criteria
+ // used are specific to the provider subclass. Returns a reference
+ // to a matching service if one exists. Otherwise it returns a NULL
+ // reference and populates |error|.
+ virtual ServiceRefPtr FindSimilarService(
+ const KeyValueStore &args, Error *error) const = 0;
+
+ // Retrieves (see FindSimilarService) or creates a service with the
+ // unique attributes in |args|. The remaining attributes will be
+ // populated (by Manager) via a later call to Service::Configure().
+ // Returns a NULL reference and populates |error| on failure.
+ virtual ServiceRefPtr GetService(const KeyValueStore &args, Error *error) = 0;
+
+ // Creates a temporary service with the identifying properties populated
+ // from |args|. Callers outside of the Provider must never register
+ // this service with the Manager or connect it since it was never added
+ // to the provider's service list.
+ virtual ServiceRefPtr CreateTemporaryService(
+ const KeyValueStore &args, Error *error) = 0;
+
+ // Starts the provider.
+ virtual void Start() = 0;
+
+ // Stops the provider (will de-register all services).
+ virtual void Stop() = 0;
+};
+
+} // namespace shill
+
+#endif // SHILL_PROVIDER_INTERFACE_H_