blob: 49baac7cce78e5d26233f95b238dffa63c2b2038 [file] [log] [blame]
Junxiao Shi7b1ba1a2014-03-29 01:01:56 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
2/**
3 * Copyright (C) 2013 Regents of the University of California.
4 * See COPYING for copyright and distribution information.
5 */
6
7#ifndef NDN_MANAGEMENT_NFD_FACE_FLAGS_HPP
8#define NDN_MANAGEMENT_NFD_FACE_FLAGS_HPP
9
10namespace ndn {
11namespace nfd {
12
13/** \class FaceFlags
14 * \brief provides additional information about a face
15 */
16enum {
17 /** \brief face is local (for scope control purpose)
18 */
19 FACE_IS_LOCAL = 1,
20 /** \brief face is created on demand (accepted incoming connection,
21 * not initiated outgoing connection)
22 */
23 FACE_IS_ON_DEMAND = 2
24 // FACE_? = 4
25 // FACE_? = 8
26};
27
28/** \brief implements getters to each face flag
29 *
30 * \tparam T class containing a FaceFlags field and implements
31 * `FaceFlags getFlags() const` method
32 */
33template<typename T>
34class FaceFlagsTraits
35{
36public:
37 bool
38 isLocal() const
39 {
40 return static_cast<const T*>(this)->getFlags() & FACE_IS_LOCAL;
41 }
42
43 bool
44 isOnDemand() const
45 {
46 return static_cast<const T*>(this)->getFlags() & FACE_IS_ON_DEMAND;
47 }
48};
49
50} // namespace nfd
51} // namespace ndn
52
53#endif // NDN_MANAGEMENT_NFD_FACE_FLAGS_HPP