consumer-db.hpp
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
23 #ifndef NDN_CONSUMER_DB_HPP
24 #define NDN_CONSUMER_DB_HPP
25 
26 #include "../name.hpp"
27 
28 namespace ndn {
29 
36 class ConsumerDb {
37 public:
42  class Error : public std::exception {
43  public:
44  Error(const std::string& errorMessage) throw();
45 
46  virtual ~Error() throw();
47 
48  std::string
49  Msg() const { return errorMessage_; }
50 
51  virtual const char*
52  what() const throw();
53 
54  private:
55  const std::string errorMessage_;
56  };
57 
61  virtual
62  ~ConsumerDb();
63 
71  virtual Blob
72  getKey(const Name& keyName) = 0;
73 
81  virtual void
82  addKey(const Name& keyName, const Blob& keyBlob) = 0;
83 
90  virtual void
91  deleteKey(const Name& keyName) = 0;
92 };
93 
94 }
95 
96 #endif
Copyright (C) 2013-2016 Regents of the University of California.
Definition: common.hpp:36
virtual void addKey(const Name &keyName, const Blob &keyBlob)=0
Add the key with keyName and keyBlob to the database.
ConsumerDb is an abstract base class the storage of decryption keys for the consumer.
Definition: consumer-db.hpp:36
A Name holds an array of Name::Component and represents an NDN name.
Definition: name.hpp:40
A Blob holds a pointer to an immutable byte array implemented as const std::vector.
Definition: blob.hpp:42
ConsumerDb::Error extends std::exception for errors using ConsumerDb methods.
Definition: consumer-db.hpp:42
virtual Blob getKey(const Name &keyName)=0
Get the key with keyName from the database.
virtual ~ConsumerDb()
The virtual Destructor.
Definition: consumer-db.cpp:41
virtual void deleteKey(const Name &keyName)=0
Delete the key with keyName from the database.