Some changes, including extension on Ccnx::Name
diff --git a/src/action-item.proto b/src/action-item.proto
index 6d50065..0144a22 100644
--- a/src/action-item.proto
+++ b/src/action-item.proto
@@ -17,6 +17,6 @@
   optional uint32 ctime = 10;
   optional uint32 mode  = 11;
 
-  optional string parent_device_name = 12;
+  optional bytes  parent_device_name = 12;
   optional uint64 parent_seq_no = 13;
 }
diff --git a/src/action-log.cc b/src/action-log.cc
index 9c8f50d..a701885 100644
--- a/src/action-log.cc
+++ b/src/action-log.cc
@@ -68,7 +68,7 @@
         {
           parent_device_id = sqlite3_column_int64 (stmt, 1);
           parent_seq_no = sqlite3_column_int64 (stmt, 2);
-          parent_device_name = string(reinterpret_cast<const char*> (sqlite3_column_text (stmt, 4)));
+          parent_device_name = string(reinterpret_cast<const char*> (sqlite3_column_blob (stmt, 4), sqlite3_column_bytes (stmt, 4)));
         }
     }
   
@@ -257,7 +257,7 @@
   // cout << "action: " << sqlite3_value_int (argv[1]) << endl;
   // cout << "filename: " << sqlite3_value_text (argv[2]) << endl;
   
-  string device_name = reinterpret_cast<const char*> (sqlite3_value_text (argv[0]));
+  string device_name (reinterpret_cast<const char*> (sqlite3_value_blob (argv[0])), sqlite3_value_bytes (argv[0]));
   sqlite3_int64 device_id = sqlite3_value_int64 (argv[1]);
   sqlite3_int64 seq_no    = sqlite3_value_int64 (argv[2]);
   int action         = sqlite3_value_int  (argv[3]);
diff --git a/src/ccnx-name.cpp b/src/ccnx-name.cpp
index 748410f..9e9f9e0 100644
--- a/src/ccnx-name.cpp
+++ b/src/ccnx-name.cpp
@@ -74,6 +74,26 @@
   }
 }
 
+Name::Name (const unsigned char *buf, const size_t length)
+{
+  ccn_indexbuf *idx = ccn_indexbuf_create();
+  const ccn_charbuf namebuf = { length, length, const_cast<unsigned char *> (buf) };
+  ccn_name_split (&namebuf, idx);
+
+  const unsigned char *compPtr = NULL;
+  size_t size = 0;
+  int i = 0;
+  while (ccn_name_comp_get(namebuf.buf, idx, i, &compPtr, &size) == 0)
+    {
+      Bytes comp;
+      readRaw (comp, compPtr, size);
+      m_comps.push_back(comp);
+      i++;
+    }
+  ccn_indexbuf_destroy(&idx);
+}
+
+
 Name &
 Name::operator=(const Name &other)
 {
diff --git a/src/db-helper.cc b/src/db-helper.cc
index a9cf576..217c3ee 100644
--- a/src/db-helper.cc
+++ b/src/db-helper.cc
@@ -33,7 +33,7 @@
 CREATE TABLE                                                    \n\
     SyncNodes(                                                  \n\
         device_id       INTEGER PRIMARY KEY AUTOINCREMENT,      \n\
-        device_name     TEXT NOT NULL,                          \n\
+        device_name     BLOB NOT NULL,                          \n\
         description     TEXT,                                   \n\
         seq_no          INTEGER NOT NULL,                       \n\
         last_known_tdi  TEXT,                                   \n\
@@ -209,11 +209,11 @@
       sqlite3_result_error (context, "Wrong arguments are supplied for ``hash'' function", -1);
       return;
     }
-  if (sqlite3_value_type (argv[0]) != SQLITE_TEXT ||
+  if (sqlite3_value_type (argv[0]) != SQLITE_BLOB ||
       sqlite3_value_type (argv[1]) != SQLITE_INTEGER)
     {
-      // _LOG_ERROR ("Hash expects (text,integer) parameters");
-      sqlite3_result_error (context, "Hash expects (text,integer) parameters", -1);
+      // _LOG_ERROR ("Hash expects (blob,integer) parameters");
+      sqlite3_result_error (context, "Hash expects (blob,integer) parameters", -1);
       return;
     }
   
@@ -231,8 +231,8 @@
       EVP_DigestInit_ex (*hash_context, HASH_FUNCTION (), 0);
     }
   
-  int nameBytes = sqlite3_value_bytes (argv[0]);
-  const unsigned char *name = sqlite3_value_text (argv[0]);
+  int nameBytes       = sqlite3_value_bytes (argv[0]);
+  const void *name    = sqlite3_value_blob  (argv[0]);
   sqlite3_int64 seqno = sqlite3_value_int64 (argv[1]);
 
   EVP_DigestUpdate (*hash_context, name, nameBytes);
diff --git a/src/sync-log.cc b/src/sync-log.cc
index 677904a..ce5b46c 100644
--- a/src/sync-log.cc
+++ b/src/sync-log.cc
@@ -36,7 +36,9 @@
   
   sqlite3_stmt *stmt;
   int res = sqlite3_prepare_v2 (m_db, "SELECT device_id, seq_no FROM SyncNodes WHERE device_name=?", -1, &stmt, 0);
-  sqlite3_bind_text (stmt, 1, m_localName.c_str (), m_localName.size (), SQLITE_STATIC);
+
+  Ccnx::CcnxCharbufPtr name = m_localName;
+  sqlite3_bind_blob (stmt, 1, name->buf (), name->length (), SQLITE_STATIC);
 
   if (sqlite3_step (stmt) == SQLITE_ROW)
     {
@@ -90,7 +92,7 @@
   if (res != SQLITE_OK)
     {
       BOOST_THROW_EXCEPTION (Error::Db ()
-                             << errmsg_info_str ("1"));
+                             << errmsg_info_str (sqlite3_errmsg(m_db)));
     }
   
   sqlite3_int64 rowId = sqlite3_last_insert_rowid (m_db);
@@ -109,7 +111,7 @@
   if (res != SQLITE_OK)
     {
       BOOST_THROW_EXCEPTION (Error::Db ()
-                             << errmsg_info_str ("4"));
+                             << errmsg_info_str (sqlite3_errmsg(m_db)));
     }
   sqlite3_finalize (insertStmt);
   
@@ -177,14 +179,15 @@
 }
 
 void
-SyncLog::UpdateDeviceSeqno (const std::string &name, sqlite3_int64 seqNo)
+SyncLog::UpdateDeviceSeqno (const Ccnx::Name &name, sqlite3_int64 seqNo)
 {
   sqlite3_stmt *stmt;
   // update is performed using trigger
   int res = sqlite3_prepare (m_db, "INSERT INTO SyncNodes (device_name, seq_no) VALUES (?,?);", 
                              -1, &stmt, 0);
 
-  res += sqlite3_bind_text  (stmt, 1, name.c_str (), name.size (), SQLITE_STATIC);
+  Ccnx::CcnxCharbufPtr nameBuf = name;
+  res += sqlite3_bind_blob  (stmt, 1, nameBuf->buf (), nameBuf->length (), SQLITE_STATIC);
   res += sqlite3_bind_int64 (stmt, 2, seqNo);
   sqlite3_step (stmt);
   
@@ -282,7 +285,7 @@
     {
       SyncState *state = msg->add_state ();
 
-      state->set_name (reinterpret_cast<const char*> (sqlite3_column_text (stmt, 0)));
+      state->set_name (reinterpret_cast<const char*> (sqlite3_column_blob (stmt, 0), sqlite3_column_bytes (stmt, 0)));
 
       sqlite3_int64 newSeqNo = sqlite3_column_int64 (stmt, 2);
       if (newSeqNo > 0)
diff --git a/src/sync-log.h b/src/sync-log.h
index bef41a7..0316294 100644
--- a/src/sync-log.h
+++ b/src/sync-log.h
@@ -24,6 +24,7 @@
 
 #include "db-helper.h"
 #include <sync-state.pb.h>
+#include <ccnx-name.h>
 
 typedef boost::shared_ptr<SyncStateMsg> SyncStateMsgPtr;
 
@@ -40,7 +41,7 @@
   
   // done
   void
-  UpdateDeviceSeqno (const std::string &name, sqlite3_int64 seqNo);
+  UpdateDeviceSeqno (const Ccnx::Name &name, sqlite3_int64 seqNo);
 
   // std::string
   // LookupForwardingAlias (const std::string &deviceName);
@@ -71,9 +72,10 @@
   FindStateDifferences (const Hash &oldHash, const Hash &newHash);  
 
 protected:
-  std::string m_localName;
-  sqlite3_int64 m_localDeviceId;
+  // std::string m_localName;
+  Ccnx::Name m_localName;
   
+  sqlite3_int64 m_localDeviceId;
 };
 
 
diff --git a/src/sync-state.proto b/src/sync-state.proto
index 9ef5e33..2aafb0c 100644
--- a/src/sync-state.proto
+++ b/src/sync-state.proto
@@ -1,12 +1,6 @@
-// message Name
-// {
-//   repeated bytes comp = 1;
-// }
-
 message SyncState
 {
-  // required Name name = 1;
-  required string name = 1;
+  required bytes name = 1;
 
   enum ActionType
   {