blob: f2a896c2e52dd140b7402f35f2ccd2cb69bc0468 [file] [log] [blame]
Junxiao Shi7357ef22016-09-07 02:39:37 +00001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
Davide Pesavento88a0d812017-08-19 21:31:42 -04002/*
Davide Pesavento3fdb02f2023-04-12 02:32:38 -04003 * Copyright (c) 2013-2023 Regents of the University of California.
Junxiao Shi7357ef22016-09-07 02:39:37 +00004 *
5 * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
6 *
7 * ndn-cxx library is free software: you can redistribute it and/or modify it under the
8 * terms of the GNU Lesser General Public License as published by the Free Software
9 * Foundation, either version 3 of the License, or (at your option) any later version.
10 *
11 * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
12 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
13 * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
14 *
15 * You should have received copies of the GNU General Public License and GNU Lesser
16 * General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
17 * <http://www.gnu.org/licenses/>.
18 *
19 * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
20 */
21
Davide Pesavento09904412021-03-24 16:40:53 -040022#ifndef NDN_CXX_MGMT_NFD_CHANNEL_STATUS_HPP
23#define NDN_CXX_MGMT_NFD_CHANNEL_STATUS_HPP
Junxiao Shi7357ef22016-09-07 02:39:37 +000024
Davide Pesavento7e780642018-11-24 15:51:34 -050025#include "ndn-cxx/encoding/block.hpp"
Junxiao Shi7357ef22016-09-07 02:39:37 +000026
Davide Pesavento47ce2ee2023-05-09 01:33:33 -040027namespace ndn::nfd {
Junxiao Shi7357ef22016-09-07 02:39:37 +000028
29/**
Davide Pesavento25e3d8c2017-02-08 22:17:46 -050030 * \ingroup management
Davide Pesaventoc860bd12022-10-04 03:23:43 -040031 * \brief Represents an item in NFD Channel dataset.
Davide Pesavento25e3d8c2017-02-08 22:17:46 -050032 * \sa https://redmine.named-data.net/projects/nfd/wiki/FaceMgmt#Channel-Dataset
Junxiao Shi7357ef22016-09-07 02:39:37 +000033 */
34class ChannelStatus
35{
36public:
37 class Error : public tlv::Error
38 {
39 public:
Junxiao Shi68b53852018-07-25 13:56:38 -060040 using tlv::Error::Error;
Junxiao Shi7357ef22016-09-07 02:39:37 +000041 };
42
43 ChannelStatus();
44
45 explicit
46 ChannelStatus(const Block& payload);
47
48 template<encoding::Tag TAG>
49 size_t
50 wireEncode(EncodingImpl<TAG>& encoder) const;
51
52 const Block&
53 wireEncode() const;
54
55 void
56 wireDecode(const Block& wire);
57
58public: // getters & setters
59 const std::string&
60 getLocalUri() const
61 {
62 return m_localUri;
63 }
64
65 ChannelStatus&
Davide Pesavento3fdb02f2023-04-12 02:32:38 -040066 setLocalUri(const std::string& localUri);
Junxiao Shi7357ef22016-09-07 02:39:37 +000067
68private:
69 std::string m_localUri;
70
71 mutable Block m_wire;
72};
73
Davide Pesavento88a0d812017-08-19 21:31:42 -040074NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(ChannelStatus);
75
Davide Pesavento9f9bd8a2017-02-06 00:33:32 -050076bool
77operator==(const ChannelStatus& a, const ChannelStatus& b);
78
79inline bool
80operator!=(const ChannelStatus& a, const ChannelStatus& b)
81{
82 return !(a == b);
83}
84
85std::ostream&
Davide Pesavento25e3d8c2017-02-08 22:17:46 -050086operator<<(std::ostream& os, const ChannelStatus& status);
Davide Pesavento9f9bd8a2017-02-06 00:33:32 -050087
Davide Pesavento47ce2ee2023-05-09 01:33:33 -040088} // namespace ndn::nfd
Junxiao Shi7357ef22016-09-07 02:39:37 +000089
Davide Pesavento09904412021-03-24 16:40:53 -040090#endif // NDN_CXX_MGMT_NFD_CHANNEL_STATUS_HPP