blob: de3754003073275b6a7151fbd2f677f83466602b [file] [log] [blame]
Yingdi Yu783ce4b2013-10-18 17:04:19 -07001/* -*- 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 Yu76dd8002013-12-24 11:16:32 +080015#include <ndn-cpp/data.hpp>
Yingdi Yu783ce4b2013-10-18 17:04:19 -070016
17class DnsStorage
18{
19public:
Yingdi Yuf8f572d2014-01-13 11:19:47 -080020 struct Error : public std::runtime_error { Error(const std::string &what) : std::runtime_error(what) {} };
21
Yingdi Yu783ce4b2013-10-18 17:04:19 -070022 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 Yub2e747d2013-11-05 23:06:43 -080033 updateDnsOthersEndorse(const ndn::Data& data, const ndn::Name& identity);
Yingdi Yu783ce4b2013-10-18 17:04:19 -070034
Yingdi Yu76dd8002013-12-24 11:16:32 +080035 ndn::ptr_lib::shared_ptr<ndn::Data>
Yingdi Yu783ce4b2013-10-18 17:04:19 -070036 getData(const ndn::Name& name);
37
38private:
39 void
Yingdi Yuf8f572d2014-01-13 11:19:47 -080040 updateDnsData(const ndn::Block& data, const std::string& identity, const std::string& name, const std::string& type, const std::string& dataName);
Yingdi Yu783ce4b2013-10-18 17:04:19 -070041
42private:
43 sqlite3 *m_db;
44};
45
46#endif