shill: Fleshes-out ScanSession enough to initiate a wifi scan.
This CL adds the code required to initiate wifi scan. This expects
wpa_supplicant to deal with the kernel's response. The code does not,
yet, initiate a scan. It just, now, contains what it needs to do so.
BUG=chromium:222088
TEST=unittest
Change-Id: Ibf8294bac455a61b3328a1db4079e0f939c9df6d
Reviewed-on: https://gerrit.chromium.org/gerrit/49272
Reviewed-by: Wade Guthrie <wdg@chromium.org>
Tested-by: Wade Guthrie <wdg@chromium.org>
Commit-Queue: David James <davidjames@chromium.org>
diff --git a/byte_string.cc b/byte_string.cc
index ea22637..f521e90 100644
--- a/byte_string.cc
+++ b/byte_string.cc
@@ -5,10 +5,14 @@
#include "shill/byte_string.h"
#include <netinet/in.h>
+#include <string.h>
+
+#include <algorithm>
#include <base/string_number_conversions.h>
using std::distance;
+using std::min;
using std::string;
using std::vector;
@@ -193,4 +197,14 @@
}
}
+// static
+bool ByteString::IsLessThan(const ByteString &lhs, const ByteString &rhs) {
+ size_t byte_count = min(lhs.GetLength(), rhs.GetLength());
+ int result = memcmp(lhs.GetConstData(), rhs.GetConstData(), byte_count);
+ if (result == 0) {
+ return byte_count == lhs.GetLength();
+ }
+ return result < 0;
+}
+
} // namespace shill