shill: connection: Choose reasonable default Broadcast Address

Calculate the correct default broadcast address since the kernel
will not do so for us.

BUG=chromium-os:23930
TEST=New unit tests -- manual testing by setting a manual IP address
and prefix length only and attaching to a network without a DHCP server.

Change-Id: Ibfb7f942a100cdc2c33a7da915f7bfa5f27ef24e
Reviewed-on: https://gerrit.chromium.org/gerrit/21507
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Ready: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
diff --git a/byte_string.cc b/byte_string.cc
index d52c626..f182756 100644
--- a/byte_string.cc
+++ b/byte_string.cc
@@ -49,7 +49,7 @@
   return true;
 }
 
-bool ByteString::ApplyMask(const ByteString &b) {
+bool ByteString::BitwiseAnd(const ByteString &b) {
   if (GetLength() != b.GetLength()) {
     return false;
   }
@@ -59,6 +59,22 @@
   return true;
 }
 
+bool ByteString::BitwiseOr(const ByteString &b) {
+  if (GetLength() != b.GetLength()) {
+    return false;
+  }
+  for (size_t i = 0; i < GetLength(); ++i) {
+    data_[i] |= b.data_[i];
+  }
+  return true;
+}
+
+void ByteString::BitwiseInvert() {
+  for (size_t i = 0; i < GetLength(); ++i) {
+    data_[i] = ~data_[i];
+  }
+}
+
 bool ByteString::Equals(const ByteString &b) const {
   return data_ == b.data_;
 }