blob: 7d0faa435244d1093b8d5f2ed95a805f51fb4544 [file] [log] [blame]
Yingdi Yu43e71612013-10-30 22:19: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#ifndef SYNC_INTRO_CERTIFICATE_H
12#define SYNC_INTRO_CERTIFICATE_H
13
Yingdi Yue8154712014-01-21 10:20:14 -080014#include <ndn-cpp-dev/security/certificate.hpp>
15#include <ndn-cpp-dev/security/identity-certificate.hpp>
Yingdi Yu43e71612013-10-30 22:19:31 -070016
Yingdi Yu46c9f1a2013-12-18 15:15:46 +080017class SyncIntroCertificate : public ndn::Certificate
Yingdi Yu43e71612013-10-30 22:19:31 -070018{
19public:
Yingdi Yu0cb0f2b2014-01-09 13:51:16 -080020 struct Error : public ndn::Certificate::Error { Error(const std::string &what) : ndn::Certificate::Error(what) {} };
21
Yingdi Yu43e71612013-10-30 22:19:31 -070022 enum IntroType{
23 PRODUCER,
24 INTRODUCER
25 };
26
27public:
28 SyncIntroCertificate ();
29
30 SyncIntroCertificate (const ndn::Name& nameSpace,
31 const ndn::Name& keyName,
32 const ndn::Name& signerName,
Yingdi Yu46c9f1a2013-12-18 15:15:46 +080033 const ndn::MillisecondsSince1970& notBefore,
34 const ndn::MillisecondsSince1970& notAfter,
35 const ndn::PublicKey& key,
Yingdi Yu43e71612013-10-30 22:19:31 -070036 const IntroType& introType = PRODUCER);
37
38 SyncIntroCertificate (const ndn::Name& nameSpace,
Yingdi Yu46c9f1a2013-12-18 15:15:46 +080039 const ndn::IdentityCertificate& identityCertificate,
Yingdi Yu43e71612013-10-30 22:19:31 -070040 const ndn::Name& signerName,
41 const IntroType& introType);
42
43 SyncIntroCertificate (const ndn::Data& data);
44
45 SyncIntroCertificate (const SyncIntroCertificate& chronosIntroCertificate);
46
47
48 virtual
49 ~SyncIntroCertificate ()
50 {}
51
Yingdi Yu46c9f1a2013-12-18 15:15:46 +080052 ndn::Data&
Yingdi Yu43e71612013-10-30 22:19:31 -070053 setName (const ndn::Name& name);
54
55 inline virtual ndn::Name
56 getPublicKeyName () const
57 { return m_keyName; }
58
59 inline IntroType
60 getIntroType()
61 { return m_introType; }
62
63 static bool
Yingdi Yu46c9f1a2013-12-18 15:15:46 +080064 isSyncIntroCertificate(const ndn::Certificate& certificate);
Yingdi Yu43e71612013-10-30 22:19:31 -070065
66protected:
67 ndn::Name m_keyName;
68 IntroType m_introType;
69};
70
71#endif