blob: 9671ee4ccdad71e09fa0c035b1fe19a09751bd04 [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
19/** \class FaceFlags
20 * \brief provides additional information about a face
21 */
22enum {
23 /** \brief face is local (for scope control purpose)
24 */
25 FACE_IS_LOCAL = 1,
26 /** \brief face is created on demand (accepted incoming connection,
27 * not initiated outgoing connection)
28 */
29 FACE_IS_ON_DEMAND = 2
30 // FACE_? = 4
31 // FACE_? = 8
32};
33
34/** \brief implements getters to each face flag
35 *
36 * \tparam T class containing a FaceFlags field and implements
37 * `FaceFlags getFlags() const` method
38 */
39template<typename T>
40class FaceFlagsTraits
41{
42public:
43 bool
44 isLocal() const
45 {
46 return static_cast<const T*>(this)->getFlags() & FACE_IS_LOCAL;
47 }
48
49 bool
50 isOnDemand() const
51 {
52 return static_cast<const T*>(this)->getFlags() & FACE_IS_ON_DEMAND;
53 }
54};
55
56} // namespace nfd
57} // namespace ndn
58
59#endif // NDN_MANAGEMENT_NFD_FACE_FLAGS_HPP