Junxiao Shi | 7357ef2 | 2016-09-07 02:39:37 +0000 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
Davide Pesavento | 88a0d81 | 2017-08-19 21:31:42 -0400 | [diff] [blame] | 2 | /* |
Davide Pesavento | 3fdb02f | 2023-04-12 02:32:38 -0400 | [diff] [blame] | 3 | * Copyright (c) 2013-2023 Regents of the University of California. |
Junxiao Shi | 7357ef2 | 2016-09-07 02:39:37 +0000 | [diff] [blame] | 4 | * |
| 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 Pesavento | 0990441 | 2021-03-24 16:40:53 -0400 | [diff] [blame] | 22 | #ifndef NDN_CXX_MGMT_NFD_CHANNEL_STATUS_HPP |
| 23 | #define NDN_CXX_MGMT_NFD_CHANNEL_STATUS_HPP |
Junxiao Shi | 7357ef2 | 2016-09-07 02:39:37 +0000 | [diff] [blame] | 24 | |
Davide Pesavento | 7e78064 | 2018-11-24 15:51:34 -0500 | [diff] [blame] | 25 | #include "ndn-cxx/encoding/block.hpp" |
Junxiao Shi | 7357ef2 | 2016-09-07 02:39:37 +0000 | [diff] [blame] | 26 | |
Davide Pesavento | 47ce2ee | 2023-05-09 01:33:33 -0400 | [diff] [blame^] | 27 | namespace ndn::nfd { |
Junxiao Shi | 7357ef2 | 2016-09-07 02:39:37 +0000 | [diff] [blame] | 28 | |
| 29 | /** |
Davide Pesavento | 25e3d8c | 2017-02-08 22:17:46 -0500 | [diff] [blame] | 30 | * \ingroup management |
Davide Pesavento | c860bd1 | 2022-10-04 03:23:43 -0400 | [diff] [blame] | 31 | * \brief Represents an item in NFD Channel dataset. |
Davide Pesavento | 25e3d8c | 2017-02-08 22:17:46 -0500 | [diff] [blame] | 32 | * \sa https://redmine.named-data.net/projects/nfd/wiki/FaceMgmt#Channel-Dataset |
Junxiao Shi | 7357ef2 | 2016-09-07 02:39:37 +0000 | [diff] [blame] | 33 | */ |
| 34 | class ChannelStatus |
| 35 | { |
| 36 | public: |
| 37 | class Error : public tlv::Error |
| 38 | { |
| 39 | public: |
Junxiao Shi | 68b5385 | 2018-07-25 13:56:38 -0600 | [diff] [blame] | 40 | using tlv::Error::Error; |
Junxiao Shi | 7357ef2 | 2016-09-07 02:39:37 +0000 | [diff] [blame] | 41 | }; |
| 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 | |
| 58 | public: // getters & setters |
| 59 | const std::string& |
| 60 | getLocalUri() const |
| 61 | { |
| 62 | return m_localUri; |
| 63 | } |
| 64 | |
| 65 | ChannelStatus& |
Davide Pesavento | 3fdb02f | 2023-04-12 02:32:38 -0400 | [diff] [blame] | 66 | setLocalUri(const std::string& localUri); |
Junxiao Shi | 7357ef2 | 2016-09-07 02:39:37 +0000 | [diff] [blame] | 67 | |
| 68 | private: |
| 69 | std::string m_localUri; |
| 70 | |
| 71 | mutable Block m_wire; |
| 72 | }; |
| 73 | |
Davide Pesavento | 88a0d81 | 2017-08-19 21:31:42 -0400 | [diff] [blame] | 74 | NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(ChannelStatus); |
| 75 | |
Davide Pesavento | 9f9bd8a | 2017-02-06 00:33:32 -0500 | [diff] [blame] | 76 | bool |
| 77 | operator==(const ChannelStatus& a, const ChannelStatus& b); |
| 78 | |
| 79 | inline bool |
| 80 | operator!=(const ChannelStatus& a, const ChannelStatus& b) |
| 81 | { |
| 82 | return !(a == b); |
| 83 | } |
| 84 | |
| 85 | std::ostream& |
Davide Pesavento | 25e3d8c | 2017-02-08 22:17:46 -0500 | [diff] [blame] | 86 | operator<<(std::ostream& os, const ChannelStatus& status); |
Davide Pesavento | 9f9bd8a | 2017-02-06 00:33:32 -0500 | [diff] [blame] | 87 | |
Davide Pesavento | 47ce2ee | 2023-05-09 01:33:33 -0400 | [diff] [blame^] | 88 | } // namespace ndn::nfd |
Junxiao Shi | 7357ef2 | 2016-09-07 02:39:37 +0000 | [diff] [blame] | 89 | |
Davide Pesavento | 0990441 | 2021-03-24 16:40:53 -0400 | [diff] [blame] | 90 | #endif // NDN_CXX_MGMT_NFD_CHANNEL_STATUS_HPP |