sqlite3-consumer-db.hpp
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
23 #ifndef NDN_SQLITE3_CONSUMER_DB_HPP
24 #define NDN_SQLITE3_CONSUMER_DB_HPP
25 
26 // Only compile if ndn-cpp-config.h defines NDN_CPP_HAVE_SQLITE3.
27 #include "../ndn-cpp-config.h"
28 #ifdef NDN_CPP_HAVE_SQLITE3
29 
30 #include <sqlite3.h>
31 #include "../common.hpp"
32 #include "consumer-db.hpp"
33 
34 namespace ndn {
35 
41 class Sqlite3ConsumerDb : public ConsumerDb {
42 public:
47  Sqlite3ConsumerDb(const std::string& databaseFilePath);
48 
56  virtual Blob
57  getKey(const Name& keyName);
58 
66  virtual void
67  addKey(const Name& keyName, const Blob& keyBlob);
68 
75  virtual void
76  deleteKey(const Name& keyName);
77 
78 private:
79  sqlite3 *database_;
80 };
81 
82 }
83 
84 #endif // NDN_CPP_HAVE_SQLITE3
85 
86 #endif
Copyright (C) 2013-2016 Regents of the University of California.
Definition: common.hpp:36
virtual void deleteKey(const Name &keyName)
Delete the key with keyName from the database.
Sqlite3ConsumerDb(const std::string &databaseFilePath)
Create an Sqlite3ConsumerDb to use the given SQLite3 file.
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
virtual Blob getKey(const Name &keyName)
Get the key with keyName from the database.
Sqlite3ConsumerDb extends ConsumerDb to implement the storage of decryption keys for the consumer usi...
Definition: sqlite3-consumer-db.hpp:41
virtual void addKey(const Name &keyName, const Blob &keyBlob)
Add the key with keyName and keyBlob to the database.