blob: 6abfee1accece817e1db396a6e384251632df977 [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"
Junxiao Shi7357ef22016-09-07 02:39:37 +000026
27namespace ndn {
28namespace nfd {
29
30/**
31 * \ingroup management
32 */
33enum FaceEventKind {
Davide Pesavento0a1afdf2017-02-18 16:34:00 -050034 FACE_EVENT_NONE = 0,
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
Davide Pesavento0a1afdf2017-02-18 16:34:00 -050044 * \sa https://redmine.named-data.net/projects/nfd/wiki/FaceMgmt#Face-Status-Change-Notification
Junxiao Shi7357ef22016-09-07 02:39:37 +000045 */
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
Junxiao Shi7357ef22016-09-07 02:39:37 +000080private:
81 FaceEventKind m_kind;
Junxiao Shi7357ef22016-09-07 02:39:37 +000082};
83
84std::ostream&
85operator<<(std::ostream& os, const FaceEventNotification& notification);
86
87} // namespace nfd
88} // namespace ndn
89
90#endif // NDN_MGMT_NFD_FACE_EVENT_NOTIFICATION_HPP