shill: Reorganizes Nl80211Message preparing to build a class hierarchy.
This is a reorganization of Nl80211Message so that breaking it into
an appropriate class hierarchy is clear and straight-forward. This CL
includes the following:
1. Moves NetlinkMessage encoding from |NetlinkSocket| up to
|Config80211| (because it makes more sense, there). This requires
exposing sequence number calculations through |Config80211| instead
of requiring access to a specific socket.
2. Breaks both the |Encode| and |InitFromNlmsg| methods into separate
header and body pieces (the header pieces will be broken-up into
their constituent parts when the NetlinkMessage class hierarchy is
created).
3. Changes the name of |message_type| into |command| to more closely
match the netlink data structures. Unfortunately, this is
necessary in order to add a _different_ |message_type| member (and
accessor) that is required by a different netlink data structure.
4. Adds a unittest for message encoding.
BUG=chromium-os:38221
TEST=unittest.
Change-Id: I2f01f3a4c6104bdd09498f143ce44518615e8150
Reviewed-on: https://gerrit.chromium.org/gerrit/44573
Reviewed-by: Christopher Wiley <wiley@chromium.org>
Reviewed-by: Wade Guthrie <wdg@chromium.org>
Tested-by: Wade Guthrie <wdg@chromium.org>
Commit-Queue: Wade Guthrie <wdg@chromium.org>
diff --git a/callback80211_metrics.cc b/callback80211_metrics.cc
index 0583165..c47cc7c 100644
--- a/callback80211_metrics.cc
+++ b/callback80211_metrics.cc
@@ -20,10 +20,10 @@
void Callback80211Metrics::Config80211MessageCallback(
const Nl80211Message &message) {
- SLOG(WiFi, 3) << "Received " << message.message_type_string()
- << " (" << + message.message_type() << ")";
+ SLOG(WiFi, 3) << "Received " << message.command_string()
+ << " (" << + message.command() << ")";
if (metrics_ &&
- message.message_type() == DeauthenticateMessage::kCommand) {
+ message.command() == DeauthenticateMessage::kCommand) {
Metrics::WiFiDisconnectByWhom by_whom =
message.const_attributes()->IsFlagAttributeTrue(
NL80211_ATTR_DISCONNECTED_BY_AP) ?