blob: cef9c1b58f24a6b4fdbf347b4ff9d663b261a940 [file] [log] [blame]
Junxiao Shi32bfeb32014-01-25 18:22:02 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
3 * Copyright (C) 2014 Named Data Networking Project
4 * See COPYING for copyright and distribution information.
5 */
6
7#include "face.hpp"
Junxiao Shi16b8bc92014-02-17 22:24:55 -07008#include "core/logger.hpp"
Junxiao Shi32bfeb32014-01-25 18:22:02 -07009
Alexander Afanasyev18bbf812014-01-29 01:40:23 -080010namespace nfd {
Junxiao Shi32bfeb32014-01-25 18:22:02 -070011
Junxiao Shi16b8bc92014-02-17 22:24:55 -070012NFD_LOG_INIT("Face");
13
Junxiao Shi8c8d2182014-01-30 22:33:00 -070014Face::Face()
15 : m_id(INVALID_FACEID)
Junxiao Shi16b8bc92014-02-17 22:24:55 -070016 , m_localControlHeaderFeatures(LOCAL_CONTROL_HEADER_FEATURE_MAX)
Junxiao Shi32bfeb32014-01-25 18:22:02 -070017{
18}
19
20Face::~Face()
21{
22}
23
Junxiao Shi8c8d2182014-01-30 22:33:00 -070024FaceId
25Face::getId() const
26{
27 return m_id;
28}
29
Alexander Afanasyev46f66472014-01-31 16:50:58 -080030// this method is private and should be used only by the Forwarder
31void
Junxiao Shi8c8d2182014-01-30 22:33:00 -070032Face::setId(FaceId faceId)
33{
34 m_id = faceId;
35}
36
Junxiao Shi32bfeb32014-01-25 18:22:02 -070037bool
38Face::isUp() const
39{
40 return true;
41}
42
43void
44Face::setDescription(const std::string& description)
45{
46 m_description = description;
47}
48
49const std::string&
50Face::getDescription() const
51{
52 return m_description;
53}
54
55bool
Junxiao Shi88884492014-02-15 15:57:43 -070056Face::isLocal() const
57{
58 return false;
59}
60
61bool
Junxiao Shi32bfeb32014-01-25 18:22:02 -070062Face::isMultiAccess() const
63{
64 return false;
65}
66
Junxiao Shi16b8bc92014-02-17 22:24:55 -070067void
68Face::setLocalControlHeaderFeature(LocalControlHeaderFeature feature, bool enabled)
Junxiao Shi32bfeb32014-01-25 18:22:02 -070069{
Junxiao Shi16b8bc92014-02-17 22:24:55 -070070 BOOST_ASSERT(feature > LOCAL_CONTROL_HEADER_FEATURE_ANY &&
71 feature < m_localControlHeaderFeatures.size());
72 m_localControlHeaderFeatures[feature] = enabled;
73 NFD_LOG_DEBUG("face" << this->getId() << " setLocalControlHeaderFeature " <<
74 (enabled ? "enable" : "disable") << " feature " << feature);
Junxiao Shi32bfeb32014-01-25 18:22:02 -070075
Junxiao Shi16b8bc92014-02-17 22:24:55 -070076 BOOST_STATIC_ASSERT(LOCAL_CONTROL_HEADER_FEATURE_ANY == 0);
77 m_localControlHeaderFeatures[LOCAL_CONTROL_HEADER_FEATURE_ANY] =
78 std::find(m_localControlHeaderFeatures.begin() + 1,
Junxiao Shi8cf83eb2014-02-18 14:25:05 -070079 m_localControlHeaderFeatures.end(), true) <
Junxiao Shi16b8bc92014-02-17 22:24:55 -070080 m_localControlHeaderFeatures.end();
Junxiao Shi8cf83eb2014-02-18 14:25:05 -070081 // 'find(..) < .end()' instead of 'find(..) != .end()' due to LLVM Bug 16816
Junxiao Shi16b8bc92014-02-17 22:24:55 -070082}
Junxiao Shi32bfeb32014-01-25 18:22:02 -070083
Alexander Afanasyev18bbf812014-01-29 01:40:23 -080084} //namespace nfd