Yingdi Yu | 01d1135 | 2013-10-18 17:04:19 -0700 | [diff] [blame] | 1 | /* -*- 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_DNS_STORAGE_H |
| 12 | #define LINKNDN_DNS_STORAGE_H |
| 13 | |
| 14 | #include <sqlite3.h> |
Yingdi Yu | 6df6125 | 2014-01-21 11:05:11 -0800 | [diff] [blame^] | 15 | #include <ndn-cpp-dev/data.hpp> |
Yingdi Yu | 01d1135 | 2013-10-18 17:04:19 -0700 | [diff] [blame] | 16 | |
| 17 | class DnsStorage |
| 18 | { |
| 19 | public: |
Yingdi Yu | c9ffa9f | 2014-01-13 11:19:47 -0800 | [diff] [blame] | 20 | struct Error : public std::runtime_error { Error(const std::string &what) : std::runtime_error(what) {} }; |
| 21 | |
Yingdi Yu | 01d1135 | 2013-10-18 17:04:19 -0700 | [diff] [blame] | 22 | DnsStorage(); |
| 23 | |
| 24 | ~DnsStorage(); |
| 25 | |
| 26 | void |
| 27 | updateDnsSelfProfileData(const ndn::Data& data, const ndn::Name& identity); |
| 28 | |
| 29 | void |
| 30 | updateDnsEndorseOthers(const ndn::Data& data, const ndn::Name& identity, const ndn::Name& endorsee); |
| 31 | |
| 32 | void |
Yingdi Yu | 8dacdf2 | 2013-11-05 23:06:43 -0800 | [diff] [blame] | 33 | updateDnsOthersEndorse(const ndn::Data& data, const ndn::Name& identity); |
Yingdi Yu | 01d1135 | 2013-10-18 17:04:19 -0700 | [diff] [blame] | 34 | |
Yingdi Yu | 6420611 | 2013-12-24 11:16:32 +0800 | [diff] [blame] | 35 | ndn::ptr_lib::shared_ptr<ndn::Data> |
Yingdi Yu | 01d1135 | 2013-10-18 17:04:19 -0700 | [diff] [blame] | 36 | getData(const ndn::Name& name); |
| 37 | |
| 38 | private: |
| 39 | void |
Yingdi Yu | c9ffa9f | 2014-01-13 11:19:47 -0800 | [diff] [blame] | 40 | updateDnsData(const ndn::Block& data, const std::string& identity, const std::string& name, const std::string& type, const std::string& dataName); |
Yingdi Yu | 01d1135 | 2013-10-18 17:04:19 -0700 | [diff] [blame] | 41 | |
| 42 | private: |
| 43 | sqlite3 *m_db; |
| 44 | }; |
| 45 | |
| 46 | #endif |