shill: add support for connecting to WPA-PSK networks

BUG=chromium-os:20897
TEST=unittests, some autotests (see below)

the following autotests now pass, at least in the wifi_vm_config:
- network_WiFiManager.000_SSID_Length_Limit
- network_WiFiSecMat.010CheckWPA_TKIP
- network_WiFiSecMat.011CheckWPA_AES
- network_WiFiSecMat.012CheckWPA_Multi
- network_WiFiSecMat.018CheckWPA_CounterMeasures

Change-Id: Ie7499fd87f661ceef3ef0aae348a08bd43c305f4
Reviewed-on: http://gerrit.chromium.org/gerrit/8586
Tested-by: mukesh agrawal <quiche@google.com>
Reviewed-by: Paul Stewart <pstew@chromium.org>
diff --git a/HACKING b/HACKING
index 3a1f7c2..109de02 100644
--- a/HACKING
+++ b/HACKING
@@ -31,10 +31,12 @@
   - Read data via the appropriate named method, rather than depending on
     implicit conversion. E.g.,
 
+       ::DBus::Variant var;
        int8 data = var.reader().get_byte();
 
     rather than
 
+       ::DBus::Variant var;
        int8 data = var;
 
     RATIONALE: The explicit version is only marginally longer than the
@@ -44,12 +46,52 @@
   - Where there is no named method, call the appropriate cast operator
     explicitly. E.g.
 
+    ::DBus::Variant var;
     vector<unsigned int> data = var.operator vector<unsigned int>();
 
     RATIONALE: Calling the cast operator explicitly avoids conflicts with
     constructors that might also be used to make the conversion. It also
     avoids requiring that the reader understand C++ conversion rules.
 
+  - Write data via the appropriate named method. E.g.,
+
+       ::DBus::Variant var;
+       int16_t data;
+       var.writer().append_int16(data);
+
+    rather than
+
+       ::DBus::Variant var;
+       int16_t data;
+       var.writer() << data;
+
+    RATIONALE: Similarly as for reading, the explicit version is only
+    marginally longer, and does not require the reader to understand
+    overload resolution.
+
+  - Where there is no named method, write by using the stream
+    insertion operator. E.g.
+
+       ::DBus::Variant var;
+       ::DBus::MessageIter writer;
+       map<string, string> data;
+       writer = var.writer();
+       writer << data;
+
+    RATIONALE: This case is somewhat unfortunate, because it's not as
+    clear as its analogue for reading. However, the alternative is to
+    duplicate the code of the stream insertion operator overloads.
+
+    Note that the writer can't be omitted. E.g.
+
+       ::DBus::Variant var;
+       map<string, string> data;
+       var.writer() << data;
+
+    does not work (at least for some types of |data|). Without the
+    intermediate variable, g++ seems to ignore templates during
+    overload resolution.
+
 - When deferring work from a signal handler (e.g. a D-Bus callback) to
   the event loop, name the deferred work function by adding "Task" to
   the name of the function deferring the work. E.g.