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 |
Junxiao Shi | 8888449 | 2014-02-15 15:57:43 -0700 | [diff] [blame] | 56 | Face::isLocal() const |
| 57 | { |
| 58 | return false; |
| 59 | } |
| 60 | |
| 61 | bool |
Junxiao Shi | 32bfeb3 | 2014-01-25 18:22:02 -0700 | [diff] [blame] | 62 | Face::isMultiAccess() const |
| 63 | { |
| 64 | return false; |
| 65 | } |
| 66 | |
Junxiao Shi | 16b8bc9 | 2014-02-17 22:24:55 -0700 | [diff] [blame^] | 67 | void |
| 68 | Face::setLocalControlHeaderFeature(LocalControlHeaderFeature feature, bool enabled) |
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_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 Shi | 32bfeb3 | 2014-01-25 18:22:02 -0700 | [diff] [blame] | 75 | |
Junxiao Shi | 16b8bc9 | 2014-02-17 22:24:55 -0700 | [diff] [blame^] | 76 | BOOST_STATIC_ASSERT(LOCAL_CONTROL_HEADER_FEATURE_ANY == 0); |
| 77 | m_localControlHeaderFeatures[LOCAL_CONTROL_HEADER_FEATURE_ANY] = |
| 78 | std::find(m_localControlHeaderFeatures.begin() + 1, |
| 79 | m_localControlHeaderFeatures.end(), true) != |
| 80 | m_localControlHeaderFeatures.end(); |
| 81 | } |
Junxiao Shi | 32bfeb3 | 2014-01-25 18:22:02 -0700 | [diff] [blame] | 82 | |
Alexander Afanasyev | 18bbf81 | 2014-01-29 01:40:23 -0800 | [diff] [blame] | 83 | } //namespace nfd |