blob: 5ca8f299d08b73441e484f789974420b513bd07c [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
56Face::isMultiAccess() const
57{
58 return false;
59}
60
Junxiao Shi16b8bc92014-02-17 22:24:55 -070061void
62Face::setLocalControlHeaderFeature(LocalControlHeaderFeature feature, bool enabled)
Junxiao Shi32bfeb32014-01-25 18:22:02 -070063{
Junxiao Shi16b8bc92014-02-17 22:24:55 -070064 BOOST_ASSERT(feature > LOCAL_CONTROL_HEADER_FEATURE_ANY &&
65 feature < m_localControlHeaderFeatures.size());
66 m_localControlHeaderFeatures[feature] = enabled;
67 NFD_LOG_DEBUG("face" << this->getId() << " setLocalControlHeaderFeature " <<
68 (enabled ? "enable" : "disable") << " feature " << feature);
Junxiao Shi32bfeb32014-01-25 18:22:02 -070069
Junxiao Shi16b8bc92014-02-17 22:24:55 -070070 BOOST_STATIC_ASSERT(LOCAL_CONTROL_HEADER_FEATURE_ANY == 0);
71 m_localControlHeaderFeatures[LOCAL_CONTROL_HEADER_FEATURE_ANY] =
72 std::find(m_localControlHeaderFeatures.begin() + 1,
Junxiao Shi8cf83eb2014-02-18 14:25:05 -070073 m_localControlHeaderFeatures.end(), true) <
Junxiao Shi16b8bc92014-02-17 22:24:55 -070074 m_localControlHeaderFeatures.end();
Junxiao Shi8cf83eb2014-02-18 14:25:05 -070075 // 'find(..) < .end()' instead of 'find(..) != .end()' due to LLVM Bug 16816
Junxiao Shi16b8bc92014-02-17 22:24:55 -070076}
Junxiao Shi32bfeb32014-01-25 18:22:02 -070077
Alexander Afanasyev18bbf812014-01-29 01:40:23 -080078} //namespace nfd