shill: Fleshes-out and adds some netlink nested attributes.

Adds some methods (|Encode|, for example) to complete nested attributes.
In addition, some attributes have been added and updated.  Some existing
nested attributes are updated to using methods submitted in previous
CLs; some previously attributes previously mis-labeled as raw (I'm
looking at you Nl80211ScanFrequencies and Nl80211ScanSsid) are updated
to nested (since these attributes are used and tested in the Config80211
unittests, those tests -- which pass -- are now testing the nested
attribute parsing methods); and a new nested attribute is added.

BUG=chromium-os:37742
TEST=unittests

Change-Id: Ibcb8fc9b8882b20e2ec901fb706c17a7304cc347
Reviewed-on: https://gerrit.chromium.org/gerrit/44181
Commit-Queue: Wade Guthrie <wdg@chromium.org>
Reviewed-by: Wade Guthrie <wdg@chromium.org>
Tested-by: Wade Guthrie <wdg@chromium.org>
diff --git a/nl80211_attribute.h b/nl80211_attribute.h
index 241ec92..dc77491 100644
--- a/nl80211_attribute.h
+++ b/nl80211_attribute.h
@@ -392,7 +392,7 @@
   static const char kMyTypeString[];
   static const Type kType;
   NetlinkNestedAttribute(int id, const char *id_string);
-  bool InitFromNlAttr(const nlattr *data) {
+  virtual bool InitFromNlAttr(const nlattr *data) {
     LOG(FATAL) << "Try initializing a _specific_ nested type, instead.";
     return false;
   }
@@ -400,12 +400,9 @@
   virtual bool ConstGetNestedAttributeList(
       AttributeListConstRefPtr *value) const;
   virtual bool SetNestedHasAValue();
-  virtual bool ToString(std::string *value) const {
-    return false;  // TODO(wdg): Actually generate a string, here.
-  }
-  virtual ByteString Encode() const {
-    return ByteString();  // TODO(wdg): Actually encode the attribute.
-  }
+  virtual void Print(int log_level, int indent) const;
+  virtual bool ToString(std::string *value) const;
+  virtual ByteString Encode() const;
 
  protected:
   // Describes a single nested attribute.  Provides the expected values and
@@ -466,22 +463,31 @@
   static const int kName;
   static const char kNameString[];
   Nl80211AttributeCqm();
-  bool InitFromNlAttr(const nlattr *data);
-  bool ToString(std::string *value) const {
-    return false;  // TODO(wdg): Need |ToString|.
-  }
+  virtual bool InitFromNlAttr(const nlattr *data);
+};
+
+class Nl80211AttributeScanFrequencies : public NetlinkNestedAttribute {
+ public:
+  static const int kName;
+  static const char kNameString[];
+  explicit Nl80211AttributeScanFrequencies();
+  virtual bool InitFromNlAttr(const nlattr *const_data);
+};
+
+class Nl80211AttributeScanSsids : public NetlinkNestedAttribute {
+ public:
+  static const int kName;
+  static const char kNameString[];
+  explicit Nl80211AttributeScanSsids();
+  virtual bool InitFromNlAttr(const nlattr *const_data);
 };
 
 class Nl80211AttributeStaInfo : public NetlinkNestedAttribute {
  public:
   static const int kName;
   static const char kNameString[];
-  explicit Nl80211AttributeStaInfo() :
-    NetlinkNestedAttribute(kName, kNameString) {}
-  bool InitFromNlAttr(const nlattr *const_data);
-  bool ToString(std::string *value) const {
-    return false;  // TODO(wdg): Need |ToString|.
-  }
+  Nl80211AttributeStaInfo();
+  virtual bool InitFromNlAttr(const nlattr *const_data);
 };
 
 // Raw.
@@ -541,21 +547,6 @@
   Nl80211AttributeRespIe() : NetlinkRawAttribute(kName, kNameString) {}
 };
 
-class Nl80211AttributeScanFrequencies : public NetlinkRawAttribute {
- public:
-  static const int kName;
-  static const char kNameString[];
-  Nl80211AttributeScanFrequencies() : NetlinkRawAttribute(kName, kNameString) {}
-};
-
-class Nl80211AttributeScanSsids : public NetlinkRawAttribute {
- public:
-  static const int kName;
-  static const char kNameString[];
-  Nl80211AttributeScanSsids() : NetlinkRawAttribute(kName, kNameString) {}
-};
-
-
 }  // namespace shill
 
 #endif  // SHILL_NLATTRIBUTE_H_