Yingdi Yu | 5ff6210 | 2013-10-13 17:24:50 -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 LINKNDN_PROFILE_H |
| 12 | #define LINKNDN_PROFILE_H |
| 13 | |
| 14 | #include <ndn.cxx/common.h> |
| 15 | #include <ndn.cxx/fields/name.h> |
| 16 | #include <ndn.cxx/fields/blob.h> |
Yingdi Yu | e9ea5c9 | 2013-11-06 18:42:34 -0800 | [diff] [blame] | 17 | #include <ndn.cxx/security/certificate/identity-certificate.h> |
Yingdi Yu | 5ff6210 | 2013-10-13 17:24:50 -0700 | [diff] [blame] | 18 | #include <map> |
| 19 | #include <string> |
| 20 | |
| 21 | class Profile |
| 22 | { |
| 23 | public: |
| 24 | typedef std::map<std::string, ndn::Blob>::iterator iterator; |
| 25 | typedef std::map<std::string, ndn::Blob>::const_iterator const_iterator; |
| 26 | public: |
| 27 | Profile() {} |
| 28 | |
Yingdi Yu | e9ea5c9 | 2013-11-06 18:42:34 -0800 | [diff] [blame] | 29 | Profile(ndn::security::IdentityCertificate& identityCertificate); |
| 30 | |
Yingdi Yu | 5ff6210 | 2013-10-13 17:24:50 -0700 | [diff] [blame] | 31 | Profile(const ndn::Name& identityName); |
| 32 | |
| 33 | Profile(const ndn::Name& identityName, |
| 34 | const std::string& name, |
| 35 | const std::string& institution); |
| 36 | |
| 37 | Profile(const Profile& profile); |
| 38 | |
| 39 | virtual |
| 40 | ~Profile() {} |
| 41 | |
| 42 | void |
| 43 | setProfileEntry(const std::string& profileType, |
| 44 | const ndn::Blob& profileValue); |
| 45 | |
| 46 | ndn::Ptr<const ndn::Blob> |
Yingdi Yu | 53b8a9c | 2013-10-14 09:36:31 -0700 | [diff] [blame] | 47 | getProfileEntry(const std::string& profileType) const; |
Yingdi Yu | 5ff6210 | 2013-10-13 17:24:50 -0700 | [diff] [blame] | 48 | |
| 49 | inline Profile::iterator |
| 50 | begin() |
| 51 | { return m_entries.begin(); } |
| 52 | |
| 53 | inline Profile::const_iterator |
| 54 | begin() const |
| 55 | { return m_entries.begin(); } |
| 56 | |
| 57 | inline Profile::iterator |
| 58 | end() |
| 59 | { return m_entries.end(); } |
| 60 | |
| 61 | inline Profile::const_iterator |
| 62 | end() const |
| 63 | { return m_entries.end(); } |
| 64 | |
| 65 | ndn::Ptr<ndn::Blob> |
| 66 | toDerBlob() const; |
| 67 | |
| 68 | static ndn::Ptr<Profile> |
| 69 | fromDerBlob(const ndn::Blob& derBlob); |
| 70 | |
Yingdi Yu | 79c25a2 | 2013-10-21 13:38:38 -0700 | [diff] [blame] | 71 | inline const std::map<std::string, ndn::Blob>& |
| 72 | getEntries() const |
| 73 | { return m_entries; } |
| 74 | |
Yingdi Yu | e9ea5c9 | 2013-11-06 18:42:34 -0800 | [diff] [blame] | 75 | inline const ndn::Name& |
| 76 | getIdentityName() const |
| 77 | { return m_identityName; } |
| 78 | |
Yingdi Yu | 5ff6210 | 2013-10-13 17:24:50 -0700 | [diff] [blame] | 79 | protected: |
| 80 | ndn::Name m_identityName; |
| 81 | std::map<std::string, ndn::Blob> m_entries; |
| 82 | }; |
| 83 | |
| 84 | |
| 85 | |
| 86 | #endif |