Add TrustedContant and ContactStorage
Add tinyxml.py in waf-tools
diff --git a/src/trusted-contact.cpp b/src/trusted-contact.cpp
new file mode 100644
index 0000000..b3271d2
--- /dev/null
+++ b/src/trusted-contact.cpp
@@ -0,0 +1,56 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2013, Regents of the University of California
+ *                     Yingdi Yu
+ *
+ * BSD license, See the LICENSE file for more information
+ *
+ * Author: Yingdi Yu <yingdi@cs.ucla.edu>
+ */
+
+#include "trusted-contact.h"
+#include <tinyxml.h>
+
+using namespace std;
+using namespace ndn;
+
+TrustedContact::TrustedContact(const EndorseCertificate& selfEndorseCertificate,
+			       const string& trustScope,
+			       const string& alias)
+  : ContactItem(selfEndorseCertificate, alias)
+{
+  TiXmlDocument xmlDoc;
+  xmlDoc.Parse(trustScope.c_str());
+  
+  TiXmlNode * it = xmlDoc.FirstChild();    
+  while(it != NULL)
+    {
+      m_trustScope.push_back(Regex::fromXmlElement(dynamic_cast<TiXmlElement *>(it)));
+      it = it->NextSibling();
+    }
+}
+
+bool 
+TrustedContact::canBeTrustedFor(const Name& name)
+{
+  vector<Ptr<Regex> >::iterator it = m_trustScope.begin();
+
+  for(; it != m_trustScope.end(); it++)
+    if((*it)->match(name))
+      return true;
+  return false;
+}
+
+Ptr<Blob> 
+TrustedContact::getTrustScopeBlob() const
+{
+  ostringstream oss;
+  TiXmlDocument * xmlDoc = new TiXmlDocument();
+
+  vector<Ptr<Regex> >::const_iterator it = m_trustScope.begin();
+  for(; it != m_trustScope.end(); it++)
+      xmlDoc->LinkEndChild((*it)->toXmlElement());
+
+  oss << *xmlDoc;
+  return Ptr<Blob>(new Blob(oss.str().c_str(), oss.str().size()));
+}