Junxiao Shi | 7357ef2 | 2016-09-07 02:39:37 +0000 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 | /** |
Davide Pesavento | 7f20d6e | 2017-01-16 14:43:58 -0500 | [diff] [blame^] | 3 | * Copyright (c) 2013-2017 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 | |
| 22 | #ifndef NDN_MGMT_NFD_FACE_EVENT_NOTIFICATION_HPP |
| 23 | #define NDN_MGMT_NFD_FACE_EVENT_NOTIFICATION_HPP |
| 24 | |
| 25 | #include "face-traits.hpp" |
| 26 | #include "../../encoding/block.hpp" |
| 27 | |
| 28 | namespace ndn { |
| 29 | namespace nfd { |
| 30 | |
| 31 | /** |
| 32 | * \ingroup management |
| 33 | */ |
| 34 | enum FaceEventKind { |
Eric Newberry | f767eba | 2016-10-07 13:37:02 -0700 | [diff] [blame] | 35 | FACE_EVENT_CREATED = 1, ///< face created |
| 36 | FACE_EVENT_DESTROYED = 2, ///< face destroyed |
| 37 | FACE_EVENT_UP = 3, ///< face went UP (from DOWN state) |
| 38 | FACE_EVENT_DOWN = 4 ///< face went DOWN (from UP state) |
Junxiao Shi | 7357ef2 | 2016-09-07 02:39:37 +0000 | [diff] [blame] | 39 | }; |
| 40 | |
| 41 | /** |
| 42 | * \ingroup management |
| 43 | * \brief represents a Face status change notification |
| 44 | * \sa http://redmine.named-data.net/projects/nfd/wiki/FaceMgmt#Face-Status-Change-Notification |
| 45 | */ |
| 46 | class FaceEventNotification : public FaceTraits<FaceEventNotification> |
| 47 | { |
| 48 | public: |
| 49 | FaceEventNotification(); |
| 50 | |
| 51 | explicit |
| 52 | FaceEventNotification(const Block& block); |
| 53 | |
| 54 | /** \brief prepend FaceEventNotification to the encoder |
| 55 | */ |
| 56 | template<encoding::Tag TAG> |
| 57 | size_t |
| 58 | wireEncode(EncodingImpl<TAG>& encoder) const; |
| 59 | |
| 60 | /** \brief encode FaceEventNotification |
| 61 | */ |
| 62 | const Block& |
| 63 | wireEncode() const; |
| 64 | |
| 65 | /** \brief decode FaceEventNotification |
| 66 | */ |
| 67 | void |
| 68 | wireDecode(const Block& wire); |
| 69 | |
| 70 | public: // getters & setters |
| 71 | FaceEventKind |
| 72 | getKind() const |
| 73 | { |
| 74 | return m_kind; |
| 75 | } |
| 76 | |
| 77 | FaceEventNotification& |
| 78 | setKind(FaceEventKind kind); |
| 79 | |
| 80 | protected: |
| 81 | void |
Davide Pesavento | 7f20d6e | 2017-01-16 14:43:58 -0500 | [diff] [blame^] | 82 | wireReset() const override; |
Junxiao Shi | 7357ef2 | 2016-09-07 02:39:37 +0000 | [diff] [blame] | 83 | |
| 84 | private: |
| 85 | FaceEventKind m_kind; |
| 86 | |
| 87 | mutable Block m_wire; |
| 88 | }; |
| 89 | |
| 90 | std::ostream& |
| 91 | operator<<(std::ostream& os, const FaceEventNotification& notification); |
| 92 | |
| 93 | } // namespace nfd |
| 94 | } // namespace ndn |
| 95 | |
| 96 | #endif // NDN_MGMT_NFD_FACE_EVENT_NOTIFICATION_HPP |