blob: cb7562619ebc81a70f19f417551ee8e8fef3b2cc [file] [log] [blame]
Yingdi Yub20ae812014-08-15 11:20:19 -07001/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
2/*
Davide Pesavento8663ed12022-07-23 03:04:27 -04003 * Copyright (c) 2012-2022 University of California, Los Angeles
Yingdi Yub20ae812014-08-15 11:20:19 -07004 *
5 * This file is part of ChronoSync, synchronization library for distributed realtime
6 * applications for NDN.
7 *
8 * ChronoSync is free software: you can redistribute it and/or modify it under the terms
9 * of the GNU General Public License as published by the Free Software Foundation, either
10 * version 3 of the License, or (at your option) any later version.
11 *
12 * ChronoSync is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
13 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 * PURPOSE. See the GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along with
17 * ChronoSync, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
18 *
19 * @author Alexander Afanasyev <http://lasr.cs.ucla.edu/afanasyev/index.html>
20 * @author Yingdi Yu <yingdi@cs.ucla.edu>
21 */
22
Davide Pesavento07684bc2021-02-07 20:09:28 -050023#ifndef CHRONOSYNC_DETAIL_COMMON_HPP
24#define CHRONOSYNC_DETAIL_COMMON_HPP
Yingdi Yub20ae812014-08-15 11:20:19 -070025
Davide Pesavento780e6462021-02-08 20:58:12 -050026#include "config.hpp"
Yingdi Yub20ae812014-08-15 11:20:19 -070027
Davide Pesavento07684bc2021-02-07 20:09:28 -050028#ifdef CHRONOSYNC_WITH_TESTS
Yingdi Yu906c2ea2014-10-31 11:24:50 -070029#define CHRONOSYNC_VIRTUAL_WITH_TESTS virtual
30#define CHRONOSYNC_PUBLIC_WITH_TESTS_ELSE_PROTECTED public
31#define CHRONOSYNC_PUBLIC_WITH_TESTS_ELSE_PRIVATE public
32#define CHRONOSYNC_PROTECTED_WITH_TESTS_ELSE_PRIVATE protected
Yingdi Yub20ae812014-08-15 11:20:19 -070033#else
Yingdi Yu906c2ea2014-10-31 11:24:50 -070034#define CHRONOSYNC_VIRTUAL_WITH_TESTS
35#define CHRONOSYNC_PUBLIC_WITH_TESTS_ELSE_PROTECTED protected
36#define CHRONOSYNC_PUBLIC_WITH_TESTS_ELSE_PRIVATE private
37#define CHRONOSYNC_PROTECTED_WITH_TESTS_ELSE_PRIVATE private
Yingdi Yub20ae812014-08-15 11:20:19 -070038#endif
39
40#include <cstddef>
Davide Pesavento780e6462021-02-08 20:58:12 -050041#include <functional>
42#include <memory>
Ashlesh Gawande08784d42017-09-06 23:40:21 -050043#include <set>
Yingdi Yub20ae812014-08-15 11:20:19 -070044#include <vector>
45
Yingdi Yub20ae812014-08-15 11:20:19 -070046#include <ndn-cxx/data.hpp>
Ashlesh Gawande08784d42017-09-06 23:40:21 -050047#include <ndn-cxx/face.hpp>
48#include <ndn-cxx/interest.hpp>
49#include <ndn-cxx/security/key-chain.hpp>
50#include <ndn-cxx/security/signing-helpers.hpp>
Alexander Afanasyevcc6f67c2020-06-03 14:00:32 -040051#include <ndn-cxx/security/validator.hpp>
Ashlesh Gawande08784d42017-09-06 23:40:21 -050052#include <ndn-cxx/security/validator-config.hpp>
53#include <ndn-cxx/util/scheduler.hpp>
54#include <ndn-cxx/util/time.hpp>
Yingdi Yub20ae812014-08-15 11:20:19 -070055
56#include <boost/algorithm/string.hpp>
Yingdi Yub20ae812014-08-15 11:20:19 -070057#include <boost/assert.hpp>
Davide Pesavento5f408ae2020-07-15 21:17:04 -040058#include <boost/core/noncopyable.hpp>
Yingdi Yub20ae812014-08-15 11:20:19 -070059#include <boost/lexical_cast.hpp>
Yingdi Yub20ae812014-08-15 11:20:19 -070060
61namespace chronosync {
62
Yingdi Yub20ae812014-08-15 11:20:19 -070063using boost::noncopyable;
Yingdi Yub20ae812014-08-15 11:20:19 -070064
Davide Pesavento780e6462021-02-08 20:58:12 -050065using std::size_t;
66
Yingdi Yu9d5679a2015-02-01 00:17:58 -080067using std::bind;
Ashlesh Gawande08784d42017-09-06 23:40:21 -050068using std::make_shared;
Ashlesh Gawande08784d42017-09-06 23:40:21 -050069using std::shared_ptr;
Yingdi Yub20ae812014-08-15 11:20:19 -070070
Yingdi Yub20ae812014-08-15 11:20:19 -070071using ndn::Block;
Ashlesh Gawande08784d42017-09-06 23:40:21 -050072using ndn::ConstBufferPtr;
73using ndn::Data;
Ashlesh Gawande08784d42017-09-06 23:40:21 -050074using ndn::Interest;
75using ndn::Name;
Alexander Afanasyevcc6f67c2020-06-03 14:00:32 -040076using ndn::security::Validator;
Davide Pesavento780e6462021-02-08 20:58:12 -050077using ndn::security::ValidationError;
Yingdi Yub20ae812014-08-15 11:20:19 -070078
79namespace name = ndn::name;
Ashlesh Gawande687cf922017-05-30 15:04:16 -050080namespace security = ndn::security;
Davide Pesavento8663ed12022-07-23 03:04:27 -040081namespace time = ndn::time;
82using namespace ndn::time_literals;
Yingdi Yub20ae812014-08-15 11:20:19 -070083
84} // namespace chronosync
85
Davide Pesavento07684bc2021-02-07 20:09:28 -050086#endif // CHRONOSYNC_DETAIL_COMMON_HPP