blob: 13201ae3187f7ff330d9da4b21e540d5f3c00598 [file] [log] [blame]
Yingdi Yudbeb8e22013-10-14 09:36:31 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
2/*
3 * Copyright (c) 2013, Regents of the University of California
4 * Yingdi Yu
5 *
6 * BSD license, See the LICENSE file for more information
7 *
8 * Author: Yingdi Yu <yingdi@cs.ucla.edu>
9 */
10
11#include "contact-item.h"
Yingdi Yudbeb8e22013-10-14 09:36:31 -070012
Yingdi Yu2ac40fb2013-10-21 13:38:38 -070013#include "logging.h"
14
Yingdi Yudbeb8e22013-10-14 09:36:31 -070015using namespace std;
16using namespace ndn;
Yingdi Yudbeb8e22013-10-14 09:36:31 -070017
Yingdi Yu2ac40fb2013-10-21 13:38:38 -070018INIT_LOGGER("ContactItem");
19
Yingdi Yufa4ce792014-02-06 18:09:22 -080020namespace chronos{
21
Yingdi Yudbeb8e22013-10-14 09:36:31 -070022ContactItem::ContactItem(const EndorseCertificate& selfEndorseCertificate,
Yingdi Yu71c01872013-11-03 16:22:05 -080023 bool isIntroducer,
Yingdi Yudbeb8e22013-10-14 09:36:31 -070024 const string& alias)
25 : m_selfEndorseCertificate(selfEndorseCertificate)
Yingdi Yu71c01872013-11-03 16:22:05 -080026 , m_isIntroducer(isIntroducer)
Yingdi Yudbeb8e22013-10-14 09:36:31 -070027{
28 Name endorsedkeyName = selfEndorseCertificate.getPublicKeyName();
Yingdi Yudbeb8e22013-10-14 09:36:31 -070029
30 m_namespace = endorsedkeyName.getSubName(0, endorsedkeyName.size() - 1);
Yingdi Yue35bdb82013-11-07 11:32:40 -080031
Yingdi Yudbeb8e22013-10-14 09:36:31 -070032
Yingdi Yufa4ce792014-02-06 18:09:22 -080033 m_name = selfEndorseCertificate.getProfile().get("name");
Yingdi Yue35bdb82013-11-07 11:32:40 -080034 m_alias = alias.empty() ? m_name : alias;
Yingdi Yufa4ce792014-02-06 18:09:22 -080035 m_institution = selfEndorseCertificate.getProfile().get("institution");
Yingdi Yudbeb8e22013-10-14 09:36:31 -070036}
37
Yingdi Yuec5e72a2013-11-03 15:05:26 -080038ContactItem::ContactItem(const ContactItem& contactItem)
39 : m_selfEndorseCertificate(contactItem.m_selfEndorseCertificate)
40 , m_namespace(contactItem.m_namespace)
41 , m_alias(contactItem.m_alias)
42 , m_name(contactItem.m_name)
43 , m_institution(contactItem.m_institution)
Yingdi Yu71c01872013-11-03 16:22:05 -080044 , m_isIntroducer(contactItem.m_isIntroducer)
45 , m_trustScope(contactItem.m_trustScope)
Yingdi Yuec5e72a2013-11-03 15:05:26 -080046{}
47
Yingdi Yu71c01872013-11-03 16:22:05 -080048}