shill: implement Manager.GetService (error-case only)

BUG=chromium-os:20254
TEST=unittests, WiFiManager/000_SSID_Length_Limit

this gives us enough to pass the autotest for
network_WiFiManager/000_SSID_Length_Limit.

Change-Id: Ib0305e707d2203327d846be3e0b206033d6a884a
Reviewed-on: http://gerrit.chromium.org/gerrit/7567
Commit-Ready: mukesh agrawal <quiche@chromium.org>
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Tested-by: mukesh agrawal <quiche@chromium.org>
diff --git a/wifi.h b/wifi.h
index 04b1d09..a92174f 100644
--- a/wifi.h
+++ b/wifi.h
@@ -17,6 +17,8 @@
 
 namespace shill {
 
+class Error;
+class KeyValueStore;
 class SupplicantInterfaceProxyInterface;
 class SupplicantProcessProxyInterface;
 class WiFiService;
@@ -47,10 +49,21 @@
   // called by WiFiService
   void ConnectTo(WiFiService *service);
 
+  // called by Manager
+  virtual WiFiServiceRefPtr GetService(const KeyValueStore &args, Error *error);
+
  private:
   typedef std::map<const std::string, WiFiEndpointRefPtr> EndpointMap;
   typedef std::map<const std::string, WiFiServiceRefPtr> ServiceMap;
 
+  static const char kManagerErrorPassphraseRequired[];
+  static const char kManagerErrorSSIDTooLong[];
+  static const char kManagerErrorSSIDTooShort[];
+  static const char kManagerErrorSSIDRequired[];
+  static const char kManagerErrorTypeRequired[];
+  static const char kManagerErrorUnsupportedSecurityMode[];
+  static const char kManagerErrorUnsupportedServiceType[];
+  static const char kManagerErrorUnsupportedServiceMode[];
   static const char kSupplicantPath[];
   static const char kSupplicantDBusAddr[];
   static const char kSupplicantWiFiDriver[];
@@ -65,6 +78,12 @@
   void ScanDoneTask();
   void ScanTask();
 
+  static std::string ParseWEPPassphrase(const std::string &passphrase,
+                                        Error *error);
+  static bool CheckWEPIsHex(const std::string &passphrase, Error *error);
+  static bool CheckWEPKeyIndex(const std::string &passphrase, Error *error);
+  static bool CheckWEPPrefix(const std::string &passphrase, Error *error);
+
   ScopedRunnableMethodFactory<WiFi> task_factory_;
   scoped_ptr<SupplicantProcessProxyInterface> supplicant_process_proxy_;
   scoped_ptr<SupplicantInterfaceProxyInterface> supplicant_interface_proxy_;