blob: 7a655539ae542f1451e6844aa0928149f0954f6d [file] [log] [blame]
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2013, Regents of the University of California
* Yingdi Yu
*
* BSD license, See the LICENSE file for more information
*
* Author: Yingdi Yu <yingdi@cs.ucla.edu>
*/
#ifndef LINKNDN_PROFILE_H
#define LINKNDN_PROFILE_H
#include <ndn.cxx/common.h>
#include <ndn.cxx/fields/name.h>
#include <ndn.cxx/fields/blob.h>
#include <ndn.cxx/security/certificate/identity-certificate.h>
#include <map>
#include <string>
class Profile
{
public:
typedef std::map<std::string, ndn::Blob>::iterator iterator;
typedef std::map<std::string, ndn::Blob>::const_iterator const_iterator;
public:
Profile() {}
Profile(const ndn::security::IdentityCertificate& identityCertificate);
Profile(const ndn::Name& identityName);
Profile(const ndn::Name& identityName,
const std::string& name,
const std::string& institution);
Profile(const Profile& profile);
virtual
~Profile() {}
void
setProfileEntry(const std::string& profileType,
const ndn::Blob& profileValue);
ndn::Ptr<const ndn::Blob>
getProfileEntry(const std::string& profileType) const;
inline Profile::iterator
begin()
{ return m_entries.begin(); }
inline Profile::const_iterator
begin() const
{ return m_entries.begin(); }
inline Profile::iterator
end()
{ return m_entries.end(); }
inline Profile::const_iterator
end() const
{ return m_entries.end(); }
ndn::Ptr<ndn::Blob>
toDerBlob() const;
static ndn::Ptr<Profile>
fromDerBlob(const ndn::Blob& derBlob);
inline const std::map<std::string, ndn::Blob>&
getEntries() const
{ return m_entries; }
inline const ndn::Name&
getIdentityName() const
{ return m_identityName; }
protected:
ndn::Name m_identityName;
std::map<std::string, ndn::Blob> m_entries;
};
#endif