blob: bdc6088f397e75e7aa14c38986b03ba8619b906f [file] [log] [blame]
Ashlesh Gawande0b2897e2018-06-20 14:40:47 -05001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2014-2018, The University of Memphis
4 *
5 * This file is part of PSync.
6 * See AUTHORS.md for complete list of PSync authors and contributors.
7 *
8 * PSync 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,
10 * either version 3 of the License, or (at your option) any later version.
11 *
12 * PSync 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 * PSync, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
18 **/
19
20#ifndef PSYNC_STATE_HPP
21#define PSYNC_STATE_HPP
22
23#include <ndn-cxx/name.hpp>
24
25namespace psync {
26
27namespace tlv {
28
29enum {
30 PSyncContent = 128
31};
32
33} // namespace tlv
34
35class State
36{
37public:
38 explicit State(const ndn::Block& block);
39
40 State() = default;
41
42 void
43 addContent(const ndn::Name& prefix);
44
45 std::vector<ndn::Name>
46 getContent() const
47 {
48 return m_content;
49 }
50
51 const ndn::Block&
52 wireEncode() const;
53
54 template<ndn::encoding::Tag TAG>
55 size_t
56 wireEncode(ndn::EncodingImpl<TAG>& block) const;
57
58 void
59 wireDecode(const ndn::Block& wire);
60
61private:
62 std::vector<ndn::Name> m_content;
63 mutable ndn::Block m_wire;
64};
65
66NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(State);
67
68std::ostream&
69operator<<(std::ostream& os, const State& State);
70
71} // namespace psync
72
73#endif // PSYNC_STATE_HPP