blob: 15595ed0dee787a9412b710e0478fdd5a938e741 [file] [log] [blame]
Junxiao Shi7b1ba1a2014-03-29 01:01:56 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
2/**
Alexander Afanasyevdfa52c42014-04-24 21:10:11 -07003 * Copyright (c) 2013-2014, Regents of the University of California.
4 * All rights reserved.
5 *
6 * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
7 * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
8 *
9 * This file licensed under New BSD License. See COPYING for detailed information about
10 * ndn-cxx library copyright, permissions, and redistribution restrictions.
Junxiao Shi7b1ba1a2014-03-29 01:01:56 -070011 */
12
13#ifndef NDN_MANAGEMENT_NFD_FACE_FLAGS_HPP
14#define NDN_MANAGEMENT_NFD_FACE_FLAGS_HPP
15
16namespace ndn {
17namespace nfd {
18
Alexander Afanasyev4671bf72014-05-19 09:01:37 -040019/**
20 * \ingroup management
21 * \enum FaceFlags
22 * \brief provides additional information about a face
Junxiao Shi7b1ba1a2014-03-29 01:01:56 -070023 */
24enum {
25 /** \brief face is local (for scope control purpose)
26 */
27 FACE_IS_LOCAL = 1,
28 /** \brief face is created on demand (accepted incoming connection,
29 * not initiated outgoing connection)
30 */
31 FACE_IS_ON_DEMAND = 2
32 // FACE_? = 4
33 // FACE_? = 8
34};
35
Alexander Afanasyev4671bf72014-05-19 09:01:37 -040036/**
37 * \ingroup management
38 * \brief implements getters to each face flag
Junxiao Shi7b1ba1a2014-03-29 01:01:56 -070039 *
Alexander Afanasyev4671bf72014-05-19 09:01:37 -040040 * \tparam T class containing a FaceFlags field and implements
41 * `FaceFlags getFlags() const` method
Junxiao Shi7b1ba1a2014-03-29 01:01:56 -070042 */
43template<typename T>
44class FaceFlagsTraits
45{
46public:
47 bool
48 isLocal() const
49 {
50 return static_cast<const T*>(this)->getFlags() & FACE_IS_LOCAL;
51 }
52
53 bool
54 isOnDemand() const
55 {
56 return static_cast<const T*>(this)->getFlags() & FACE_IS_ON_DEMAND;
57 }
58};
59
60} // namespace nfd
61} // namespace ndn
62
63#endif // NDN_MANAGEMENT_NFD_FACE_FLAGS_HPP