blob: f101f253c0ed42a961f288420f32a95f3c95adc9 [file] [log] [blame]
Alexander Afanasyevc169a812014-05-20 20:37:29 -04001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
Alexander Afanasyev44b438a2014-03-19 12:51:49 -07002/**
Alexander Afanasyevc169a812014-05-20 20:37:29 -04003 * Copyright (c) 2013-2014 Regents of the University of California.
Alexander Afanasyevdfa52c42014-04-24 21:10:11 -07004 *
5 * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
Alexander Afanasyevdfa52c42014-04-24 21:10:11 -07006 *
Alexander Afanasyevc169a812014-05-20 20:37:29 -04007 * 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.
Alexander Afanasyev44b438a2014-03-19 12:51:49 -070020 */
21
22#ifndef NDN_MANAGEMENT_NFD_FACE_EVENT_NOTIFICATION_HPP
23#define NDN_MANAGEMENT_NFD_FACE_EVENT_NOTIFICATION_HPP
24
Chengyu Fan36dca992014-09-25 13:42:03 -060025#include "nfd-face-traits.hpp"
Junxiao Shi65f1a712014-11-20 14:59:36 -070026#include "../encoding/block.hpp"
Alexander Afanasyev44b438a2014-03-19 12:51:49 -070027
28namespace ndn {
29namespace nfd {
30
Alexander Afanasyev4671bf72014-05-19 09:01:37 -040031/**
32 * \ingroup management
33 */
Junxiao Shi7b1ba1a2014-03-29 01:01:56 -070034enum FaceEventKind {
35 FACE_EVENT_CREATED = 1,
36 FACE_EVENT_DESTROYED = 2
37};
Alexander Afanasyev44b438a2014-03-19 12:51:49 -070038
Alexander Afanasyev4671bf72014-05-19 09:01:37 -040039/**
40 * \ingroup management
41 * \brief represents a Face status change notification
42 * \sa http://redmine.named-data.net/projects/nfd/wiki/FaceMgmt#Face-Status-Change-Notification
Junxiao Shi7b1ba1a2014-03-29 01:01:56 -070043 */
Chengyu Fan36dca992014-09-25 13:42:03 -060044class FaceEventNotification : public FaceTraits<FaceEventNotification>
Alexander Afanasyev44b438a2014-03-19 12:51:49 -070045{
46public:
Junxiao Shi7b1ba1a2014-03-29 01:01:56 -070047 FaceEventNotification();
Alexander Afanasyev44b438a2014-03-19 12:51:49 -070048
49 explicit
Chengyu Fan36dca992014-09-25 13:42:03 -060050 FaceEventNotification(const Block& block);
Junxiao Shi7b1ba1a2014-03-29 01:01:56 -070051
52 /** \brief prepend FaceEventNotification to the encoder
53 */
54 template<bool T>
55 size_t
56 wireEncode(EncodingImpl<T>& encoder) const;
57
58 /** \brief encode FaceEventNotification
59 */
60 const Block&
61 wireEncode() const;
62
63 /** \brief decode FaceEventNotification
64 */
65 void
66 wireDecode(const Block& wire);
67
68public: // getters & setters
69 FaceEventKind
70 getKind() const
71 {
72 return m_kind;
73 }
74
75 FaceEventNotification&
Chengyu Fan36dca992014-09-25 13:42:03 -060076 setKind(FaceEventKind kind);
Alexander Afanasyev44b438a2014-03-19 12:51:49 -070077
Chengyu Fan36dca992014-09-25 13:42:03 -060078protected:
79 void
80 wireReset() const;
Alexander Afanasyev2c753312014-03-20 17:31:01 -070081
Alexander Afanasyev44b438a2014-03-19 12:51:49 -070082private:
83 FaceEventKind m_kind;
Alexander Afanasyev44b438a2014-03-19 12:51:49 -070084
85 mutable Block m_wire;
86};
87
Chengyu Fan36dca992014-09-25 13:42:03 -060088std::ostream&
89operator<<(std::ostream& os, const FaceEventNotification& notification);
Alexander Afanasyev44b438a2014-03-19 12:51:49 -070090
91} // namespace nfd
92} // namespace ndn
93
94#endif // NDN_MANAGEMENT_NFD_FACE_EVENT_NOTIFICATION_HPP