blob: 0126b64ed1c4abcce95f1bee7deb9b20db01b050 [file] [log] [blame]
Junxiao Shi7357ef22016-09-07 02:39:37 +00001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
Davide Pesavento7f20d6e2017-01-16 14:43:58 -05003 * Copyright (c) 2013-2017 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
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
28namespace ndn {
29namespace nfd {
30
31/**
32 * \ingroup management
33 */
34enum FaceEventKind {
Eric Newberryf767eba2016-10-07 13:37:02 -070035 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 Shi7357ef22016-09-07 02:39:37 +000039};
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 */
46class FaceEventNotification : public FaceTraits<FaceEventNotification>
47{
48public:
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
70public: // getters & setters
71 FaceEventKind
72 getKind() const
73 {
74 return m_kind;
75 }
76
77 FaceEventNotification&
78 setKind(FaceEventKind kind);
79
80protected:
81 void
Davide Pesavento7f20d6e2017-01-16 14:43:58 -050082 wireReset() const override;
Junxiao Shi7357ef22016-09-07 02:39:37 +000083
84private:
85 FaceEventKind m_kind;
86
87 mutable Block m_wire;
88};
89
90std::ostream&
91operator<<(std::ostream& os, const FaceEventNotification& notification);
92
93} // namespace nfd
94} // namespace ndn
95
96#endif // NDN_MGMT_NFD_FACE_EVENT_NOTIFICATION_HPP