Junxiao Shi | 32bfeb3 | 2014-01-25 18:22:02 -0700 | [diff] [blame] | 1 | /* -*- 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 Shi | 16b8bc9 | 2014-02-17 22:24:55 -0700 | [diff] [blame] | 8 | #include "core/logger.hpp" |
Junxiao Shi | 32bfeb3 | 2014-01-25 18:22:02 -0700 | [diff] [blame] | 9 | |
Alexander Afanasyev | 18bbf81 | 2014-01-29 01:40:23 -0800 | [diff] [blame] | 10 | namespace nfd { |
Junxiao Shi | 32bfeb3 | 2014-01-25 18:22:02 -0700 | [diff] [blame] | 11 | |
Junxiao Shi | 16b8bc9 | 2014-02-17 22:24:55 -0700 | [diff] [blame] | 12 | NFD_LOG_INIT("Face"); |
| 13 | |
Junxiao Shi | 8c8d218 | 2014-01-30 22:33:00 -0700 | [diff] [blame] | 14 | Face::Face() |
| 15 | : m_id(INVALID_FACEID) |
Junxiao Shi | 16b8bc9 | 2014-02-17 22:24:55 -0700 | [diff] [blame] | 16 | , m_localControlHeaderFeatures(LOCAL_CONTROL_HEADER_FEATURE_MAX) |
Junxiao Shi | 32bfeb3 | 2014-01-25 18:22:02 -0700 | [diff] [blame] | 17 | { |
| 18 | } |
| 19 | |
| 20 | Face::~Face() |
| 21 | { |
| 22 | } |
| 23 | |
Junxiao Shi | 8c8d218 | 2014-01-30 22:33:00 -0700 | [diff] [blame] | 24 | FaceId |
| 25 | Face::getId() const |
| 26 | { |
| 27 | return m_id; |
| 28 | } |
| 29 | |
Alexander Afanasyev | 46f6647 | 2014-01-31 16:50:58 -0800 | [diff] [blame] | 30 | // this method is private and should be used only by the Forwarder |
| 31 | void |
Junxiao Shi | 8c8d218 | 2014-01-30 22:33:00 -0700 | [diff] [blame] | 32 | Face::setId(FaceId faceId) |
| 33 | { |
| 34 | m_id = faceId; |
| 35 | } |
| 36 | |
Junxiao Shi | 32bfeb3 | 2014-01-25 18:22:02 -0700 | [diff] [blame] | 37 | bool |
| 38 | Face::isUp() const |
| 39 | { |
| 40 | return true; |
| 41 | } |
| 42 | |
| 43 | void |
| 44 | Face::setDescription(const std::string& description) |
| 45 | { |
| 46 | m_description = description; |
| 47 | } |
| 48 | |
| 49 | const std::string& |
| 50 | Face::getDescription() const |
| 51 | { |
| 52 | return m_description; |
| 53 | } |
| 54 | |
| 55 | bool |
| 56 | Face::isMultiAccess() const |
| 57 | { |
| 58 | return false; |
| 59 | } |
| 60 | |
Junxiao Shi | 16b8bc9 | 2014-02-17 22:24:55 -0700 | [diff] [blame] | 61 | void |
| 62 | Face::setLocalControlHeaderFeature(LocalControlHeaderFeature feature, bool enabled) |
Junxiao Shi | 32bfeb3 | 2014-01-25 18:22:02 -0700 | [diff] [blame] | 63 | { |
Junxiao Shi | 16b8bc9 | 2014-02-17 22:24:55 -0700 | [diff] [blame] | 64 | 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 Shi | 32bfeb3 | 2014-01-25 18:22:02 -0700 | [diff] [blame] | 69 | |
Junxiao Shi | 16b8bc9 | 2014-02-17 22:24:55 -0700 | [diff] [blame] | 70 | 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 Shi | 8cf83eb | 2014-02-18 14:25:05 -0700 | [diff] [blame] | 73 | m_localControlHeaderFeatures.end(), true) < |
Junxiao Shi | 16b8bc9 | 2014-02-17 22:24:55 -0700 | [diff] [blame] | 74 | m_localControlHeaderFeatures.end(); |
Junxiao Shi | 8cf83eb | 2014-02-18 14:25:05 -0700 | [diff] [blame] | 75 | // 'find(..) < .end()' instead of 'find(..) != .end()' due to LLVM Bug 16816 |
Junxiao Shi | 16b8bc9 | 2014-02-17 22:24:55 -0700 | [diff] [blame] | 76 | } |
Junxiao Shi | 32bfeb3 | 2014-01-25 18:22:02 -0700 | [diff] [blame] | 77 | |
Alexander Afanasyev | 18bbf81 | 2014-01-29 01:40:23 -0800 | [diff] [blame] | 78 | } //namespace nfd |