Yingdi Yu | 43e7161 | 2013-10-30 22:19:31 -0700 | [diff] [blame] | 1 | /* -*- 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 Yu | e815471 | 2014-01-21 10:20:14 -0800 | [diff] [blame] | 14 | #include <ndn-cpp-dev/security/certificate.hpp> |
| 15 | #include <ndn-cpp-dev/security/identity-certificate.hpp> |
Yingdi Yu | 43e7161 | 2013-10-30 22:19:31 -0700 | [diff] [blame] | 16 | |
Yingdi Yu | 46c9f1a | 2013-12-18 15:15:46 +0800 | [diff] [blame] | 17 | class SyncIntroCertificate : public ndn::Certificate |
Yingdi Yu | 43e7161 | 2013-10-30 22:19:31 -0700 | [diff] [blame] | 18 | { |
| 19 | public: |
Yingdi Yu | 0cb0f2b | 2014-01-09 13:51:16 -0800 | [diff] [blame] | 20 | struct Error : public ndn::Certificate::Error { Error(const std::string &what) : ndn::Certificate::Error(what) {} }; |
| 21 | |
Yingdi Yu | 43e7161 | 2013-10-30 22:19:31 -0700 | [diff] [blame] | 22 | enum IntroType{ |
| 23 | PRODUCER, |
| 24 | INTRODUCER |
| 25 | }; |
| 26 | |
| 27 | public: |
| 28 | SyncIntroCertificate (); |
| 29 | |
| 30 | SyncIntroCertificate (const ndn::Name& nameSpace, |
| 31 | const ndn::Name& keyName, |
| 32 | const ndn::Name& signerName, |
Yingdi Yu | 46c9f1a | 2013-12-18 15:15:46 +0800 | [diff] [blame] | 33 | const ndn::MillisecondsSince1970& notBefore, |
| 34 | const ndn::MillisecondsSince1970& notAfter, |
| 35 | const ndn::PublicKey& key, |
Yingdi Yu | 43e7161 | 2013-10-30 22:19:31 -0700 | [diff] [blame] | 36 | const IntroType& introType = PRODUCER); |
| 37 | |
| 38 | SyncIntroCertificate (const ndn::Name& nameSpace, |
Yingdi Yu | 46c9f1a | 2013-12-18 15:15:46 +0800 | [diff] [blame] | 39 | const ndn::IdentityCertificate& identityCertificate, |
Yingdi Yu | 43e7161 | 2013-10-30 22:19:31 -0700 | [diff] [blame] | 40 | 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 Yu | 46c9f1a | 2013-12-18 15:15:46 +0800 | [diff] [blame] | 52 | ndn::Data& |
Yingdi Yu | 43e7161 | 2013-10-30 22:19:31 -0700 | [diff] [blame] | 53 | 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 Yu | 46c9f1a | 2013-12-18 15:15:46 +0800 | [diff] [blame] | 64 | isSyncIntroCertificate(const ndn::Certificate& certificate); |
Yingdi Yu | 43e7161 | 2013-10-30 22:19:31 -0700 | [diff] [blame] | 65 | |
| 66 | protected: |
| 67 | ndn::Name m_keyName; |
| 68 | IntroType m_introType; |
| 69 | }; |
| 70 | |
| 71 | #endif |