shill: Add RTNLMessage: rtnl message parser/composer

Add RTNLMessage type.  This will be used to remove some bespoke
messaging parsing, but more immediately, it will be used by the
routing code.

BUG=chromium-os:17277
TEST=New unittest

Change-Id: Idb0559b907f018e021193c51d30f5027c8debec3
Reviewed-on: http://gerrit.chromium.org/gerrit/4183
Reviewed-by: Darin Petkov <petkov@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
diff --git a/byte_string.h b/byte_string.h
index c4c38b2..0077ff0 100644
--- a/byte_string.h
+++ b/byte_string.h
@@ -5,6 +5,7 @@
 #ifndef SHILL_BYTE_STRING_
 #define SHILL_BYTE_STRING_
 
+#include <string>
 #include <vector>
 
 #include <base/basictypes.h>
@@ -19,6 +20,12 @@
   explicit ByteString(size_t length) : data_(length) {}
   ByteString(const unsigned char *data, size_t length)
       : data_(data, data + length) {}
+  ByteString(const std::string &data, bool copy_terminator)
+    : data_(reinterpret_cast<const unsigned char *>(data.c_str()),
+            reinterpret_cast<const unsigned char *>(data.c_str() +
+                                                    data.length() +
+                                                    (copy_terminator ?
+                                                     1 : 0))) {}
 
   ByteString &operator=(const ByteString &b) {
     data_ = b.data_;
@@ -43,6 +50,10 @@
 
   bool IsZero() const;
   bool Equals(const ByteString &b) const;
+  void Append(const ByteString &b);
+  void Resize(int size) {
+    data_.resize(size, 0);
+  }
 
  private:
   std::vector<unsigned char> data_;