blob: b020408db56111d3c7a8e1777a0caa3ff31ef13d [file] [log] [blame]
Yingdi Yub4be64a2013-10-13 17:24:50 -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 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 Yu2e3199c2013-11-06 18:42:34 -080017#include <ndn.cxx/security/certificate/identity-certificate.h>
Yingdi Yub4be64a2013-10-13 17:24:50 -070018#include <map>
19#include <string>
20
21class Profile
22{
23public:
24 typedef std::map<std::string, ndn::Blob>::iterator iterator;
25 typedef std::map<std::string, ndn::Blob>::const_iterator const_iterator;
26public:
27 Profile() {}
28
Yingdi Yu2e3199c2013-11-06 18:42:34 -080029 Profile(ndn::security::IdentityCertificate& identityCertificate);
30
Yingdi Yub4be64a2013-10-13 17:24:50 -070031 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 Yudbeb8e22013-10-14 09:36:31 -070047 getProfileEntry(const std::string& profileType) const;
Yingdi Yub4be64a2013-10-13 17:24:50 -070048
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 Yu2ac40fb2013-10-21 13:38:38 -070071 inline const std::map<std::string, ndn::Blob>&
72 getEntries() const
73 { return m_entries; }
74
Yingdi Yu2e3199c2013-11-06 18:42:34 -080075 inline const ndn::Name&
76 getIdentityName() const
77 { return m_identityName; }
78
Yingdi Yub4be64a2013-10-13 17:24:50 -070079protected:
80 ndn::Name m_identityName;
81 std::map<std::string, ndn::Blob> m_entries;
82};
83
84
85
86#endif