partially working new chronochat
diff --git a/src/chronos-invitation.cpp b/src/chronos-invitation.cpp
new file mode 100644
index 0000000..7ec0243
--- /dev/null
+++ b/src/chronos-invitation.cpp
@@ -0,0 +1,98 @@
+/* -*- 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 "chronos-invitation.h"
+#include "exception.h"
+#include "logging.h"
+
+using namespace std;
+using namespace ndn;
+
+INIT_LOGGER("ChronosInvitation");
+
+ChronosInvitation::ChronosInvitation(const ndn::Name& interestName)
+  : m_interestName(interestName)
+{
+  if(interestName.get(0).toUri() != string("ndn")
+     || interestName.get(1).toUri() != string("broadcast")
+     || interestName.get(2).toUri() != string("chronos")
+     || interestName.get(3).toUri() != string("invitation"))
+    throw LnException("Wrong ChronosInvitation Name");
+    
+  int i = 4;
+  int size = interestName.size();
+
+  string chatroomStr("chatroom");
+  int inviteeBegin = 4;
+  for(; i < size; i++)
+    if(interestName.get(i).toUri() == chatroomStr)
+      break;
+
+  if(i >= size)
+    throw LnException("Wrong ChronosInvitation Name, No chatroom tag");
+  m_inviteeNameSpace = interestName.getSubName(inviteeBegin, i - inviteeBegin);
+
+  _LOG_DEBUG(m_inviteeNameSpace.toUri());
+
+  string inviterPrefixStr("inviter-prefix");
+  int chatroomBegin = (++i);
+  for(; i < size;  i++)
+    if(interestName.get(i).toUri() == inviterPrefixStr)
+      break;
+
+  if(i > size)
+    throw LnException("Wrong ChronosInvitation Name, No inviter-prefix tag");
+  m_chatroom = interestName.getSubName(chatroomBegin, i - chatroomBegin);
+
+  _LOG_DEBUG(m_chatroom.toUri());
+
+  string inviterStr("inviter");
+  int inviterPrefixBegin = (++i);
+  for(; i < size; i++)
+    if(interestName.get(i).toUri() == inviterStr)
+      break;
+  
+  if(i > size)
+    throw LnException("Wrong ChronosInvitation Name, No inviter tag");
+  m_inviterPrefix = interestName.getSubName(inviterPrefixBegin, i - inviterPrefixBegin);
+
+  _LOG_DEBUG(m_inviterPrefix.toUri());
+
+  int inviterCertBegin = (++i);
+  m_inviterCertificateName = interestName.getSubName(inviterCertBegin, size - 1 - inviterCertBegin);
+
+  _LOG_DEBUG(m_inviterCertificateName.toUri());
+  
+  string signature = interestName.get(-1).toBlob();
+  m_signatureBits.insert(m_signatureBits.end(), signature.begin(), signature.end());
+
+  string keyStr("KEY");
+  int keyId = 0;
+  for(; keyId < m_inviterCertificateName.size(); keyId++)
+    if(m_inviterCertificateName.get(keyId).toUri() == keyStr)
+      break;
+  if(keyId >= m_inviterCertificateName.size())
+    throw LnException("Wrong ChronosInvitation Name, no KEY tag in inviter Certificate Name");
+  m_inviterNameSpace = m_inviterCertificateName.getSubName(0, keyId);
+
+  string signedName = interestName.getSubName(0, size - 1).toUri();
+  m_signedBlob.insert(m_signedBlob.end(), signedName.begin(), signedName.end());
+}
+
+ChronosInvitation::ChronosInvitation(const ChronosInvitation& invitation)
+  : m_interestName(invitation.m_interestName)
+  , m_inviteeNameSpace(invitation.m_inviteeNameSpace)
+  , m_chatroom(invitation.m_chatroom)
+  , m_inviterPrefix(invitation.m_inviterPrefix)
+  , m_inviterCertificateName(invitation.m_inviterCertificateName)
+  , m_signatureBits(invitation.m_signatureBits)
+  , m_inviterNameSpace(invitation.m_inviterNameSpace)
+  , m_signedBlob(invitation.m_signedBlob)
+{}