All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
sqlite3-group-manager-db.hpp
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
23 #ifndef NDN_SQLITE3_GROUP_MANAGER_DB_HPP
24 #define NDN_SQLITE3_GROUP_MANAGER_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 <map>
31 #include "../common.hpp"
32 #include "group-manager-db.hpp"
33 
34 struct sqlite3;
35 
36 namespace ndn {
37 
44 public:
49  Sqlite3GroupManagerDb(const std::string& databaseFilePath);
50 
52 
59  virtual bool
60  hasSchedule(const std::string& name);
61 
67  virtual void
68  listAllScheduleNames(std::vector<std::string>& nameList);
69 
77  virtual ptr_lib::shared_ptr<Schedule>
78  getSchedule(const std::string& name);
79 
90  virtual void
92  (const std::string& name, std::map<Name, Blob>& memberMap);
93 
101  virtual void
102  addSchedule(const std::string& name, const Schedule& schedule);
103 
110  virtual void
111  deleteSchedule(const std::string& name);
112 
121  virtual void
122  renameSchedule(const std::string& oldName, const std::string& newName);
123 
132  virtual void
133  updateSchedule(const std::string& name, const Schedule& schedule);
134 
136 
143  virtual bool
144  hasMember(const Name& identity);
145 
151  virtual void
152  listAllMembers(std::vector<Name>& nameList);
153 
161  virtual std::string
162  getMemberSchedule(const Name& identity);
163 
173  virtual void
174  addMember
175  (const std::string& scheduleName, const Name& keyName, const Blob& key);
176 
185  virtual void
186  updateMemberSchedule(const Name& identity, const std::string& scheduleName);
187 
194  virtual void
195  deleteMember(const Name& identity);
196 
203  virtual bool
204  hasEKey(const Name& eKeyName);
205 
214  virtual void
215  addEKey(const Name& eKeyName, const Blob& publicKey, const Blob& privateKey);
216 
225  virtual void
226  getEKey(const Name& eKeyName, Blob& publicKey, Blob& privateKey);
227 
234  virtual void
235  cleanEKeys();
236 
243  virtual void
244  deleteEKey(const Name& eKeyName);
245 
246 private:
253  int
254  getScheduleId(const std::string& name);
255 
256  struct sqlite3 *database_;
257  std::map<Name, Blob> privateKeyBase_;
258 };
259 
260 }
261 
262 #endif // NDN_CPP_HAVE_SQLITE3
263 
264 #endif
GroupManagerDb is an abstract base class for the storage of data used by the GroupManager.
Definition: group-manager-db.hpp:39
Schedule is used to manage the times when a member can access data using two sets of RepetitiveInterv...
Definition: schedule.hpp:43
virtual ptr_lib::shared_ptr< Schedule > getSchedule(const std::string &name)
Get a schedule with the given name.
virtual void getEKey(const Name &eKeyName, Blob &publicKey, Blob &privateKey)
Get the group key pair with the name eKeyName from the database.
virtual void deleteMember(const Name &identity)
Delete a member with the given identity name.
virtual std::string getMemberSchedule(const Name &identity)
Get the name of the schedule for the given member's identity name.
virtual void addSchedule(const std::string &name, const Schedule &schedule)
Add a schedule with the given name.
A Name holds an array of Name::Component and represents an NDN name.
Definition: name.hpp:40
virtual void cleanEKeys()
Delete all the EKeys in the database.
A Blob holds a pointer to an immutable byte array implemented as const std::vector<uint8_t>.
Definition: blob.hpp:42
virtual void getScheduleMembers(const std::string &name, std::map< Name, Blob > &memberMap)
For each member using the given schedule, get the name and public key DER of the member's key...
virtual bool hasMember(const Name &identity)
Check if there is a member with the given identity name.
virtual bool hasEKey(const Name &eKeyName)
Check if there is an EKey with the name eKeyName in the database.
virtual void listAllScheduleNames(std::vector< std::string > &nameList)
Append all the names of the schedules to the nameList.
virtual void updateMemberSchedule(const Name &identity, const std::string &scheduleName)
Change the name of the schedule for the given member's identity name.
virtual void listAllMembers(std::vector< Name > &nameList)
Append all the members to the nameList.
virtual void renameSchedule(const std::string &oldName, const std::string &newName)
Rename a schedule with oldName to newName.
virtual void updateSchedule(const std::string &name, const Schedule &schedule)
Update the schedule with name and replace the old object with the given schedule. ...
Sqlite3GroupManagerDb(const std::string &databaseFilePath)
Create an Sqlite3GroupManagerDb to use the given SQLite3 file.
virtual bool hasSchedule(const std::string &name)
Check if there is a schedule with the given name.
virtual void addMember(const std::string &scheduleName, const Name &keyName, const Blob &key)
Add a new member with the given key named keyName into a schedule named scheduleName.
virtual void deleteEKey(const Name &eKeyName)
Delete the EKey with name eKeyName from the database.
virtual void deleteSchedule(const std::string &name)
Delete the schedule with the given name.
Sqlite3GroupManagerDb extends GroupManagerDb to implement the storage of data used by the GroupManage...
Definition: sqlite3-group-manager-db.hpp:43
virtual void addEKey(const Name &eKeyName, const Blob &publicKey, const Blob &privateKey)
Add the EKey with name eKeyName to the database.