blob: c9560ec9e44aa16c5879436e72cc857aeeaf0eaa [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
Yingdi Yu286eb182014-01-23 23:20:43 -080055 inline const ndn::Name &
56 getPublicKeyName() const;
Yingdi Yu43e71612013-10-30 22:19:31 -070057
58 inline IntroType
Yingdi Yu286eb182014-01-23 23:20:43 -080059 getIntroType();
Yingdi Yu43e71612013-10-30 22:19:31 -070060
Yingdi Yu286eb182014-01-23 23:20:43 -080061 inline const ndn::Name &
62 getNameSpace() const;
63
Yingdi Yu43e71612013-10-30 22:19:31 -070064 static bool
Yingdi Yu46c9f1a2013-12-18 15:15:46 +080065 isSyncIntroCertificate(const ndn::Certificate& certificate);
Yingdi Yu43e71612013-10-30 22:19:31 -070066
67protected:
Yingdi Yu286eb182014-01-23 23:20:43 -080068 ndn::Name m_nameSpace;
Yingdi Yu43e71612013-10-30 22:19:31 -070069 ndn::Name m_keyName;
70 IntroType m_introType;
71};
72
Yingdi Yu286eb182014-01-23 23:20:43 -080073SyncIntroCertificate::IntroType
74SyncIntroCertificate::getIntroType()
75{ return m_introType; }
76
77const ndn::Name &
78SyncIntroCertificate::getPublicKeyName () const
79{ return m_keyName; }
80
81const ndn::Name &
82SyncIntroCertificate::getNameSpace() const
83{ return m_nameSpace; }
84
Yingdi Yu43e71612013-10-30 22:19:31 -070085#endif