Steve DiBenedetto | 042bfe9 | 2014-01-30 15:05:08 -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 | #ifndef NFD_MGMT_FIB_MANAGER_HPP |
| 8 | #define NFD_MGMT_FIB_MANAGER_HPP |
| 9 | |
| 10 | #include "common.hpp" |
| 11 | #include "face/face.hpp" |
Steve DiBenedetto | 43cd037 | 2014-02-01 17:05:07 -0700 | [diff] [blame^] | 12 | #include "mgmt/app-face.hpp" |
| 13 | #include "fw/strategy.hpp" |
Steve DiBenedetto | 042bfe9 | 2014-01-30 15:05:08 -0700 | [diff] [blame] | 14 | #include "mgmt/manager-base.hpp" |
| 15 | |
| 16 | namespace nfd { |
| 17 | |
Steve DiBenedetto | 042bfe9 | 2014-01-30 15:05:08 -0700 | [diff] [blame] | 18 | class Forwarder; |
| 19 | class Fib; |
| 20 | |
| 21 | class FibManager : public ManagerBase |
| 22 | { |
| 23 | public: |
| 24 | |
Steve DiBenedetto | 3970c89 | 2014-01-31 23:31:13 -0700 | [diff] [blame] | 25 | FibManager(Fib& fib, |
| 26 | function<shared_ptr<Face>(FaceId)> getFace, |
| 27 | shared_ptr<AppFace> face); |
Steve DiBenedetto | 042bfe9 | 2014-01-30 15:05:08 -0700 | [diff] [blame] | 28 | |
| 29 | void |
| 30 | onFibRequest(const Interest& request); |
| 31 | |
Steve DiBenedetto | 042bfe9 | 2014-01-30 15:05:08 -0700 | [diff] [blame] | 32 | private: |
| 33 | |
| 34 | void |
| 35 | fibInsert(const Interest& request); |
| 36 | |
| 37 | void |
| 38 | fibDelete(const Interest& request); |
| 39 | |
| 40 | void |
| 41 | fibAddNextHop(const Interest& request); |
| 42 | |
| 43 | void |
| 44 | fibRemoveNextHop(const Interest& request); |
| 45 | |
| 46 | void |
| 47 | fibStrategy(const Interest& request); |
| 48 | |
| 49 | // void |
| 50 | // onConfig(ConfigFile::Node section, bool isDryRun); |
| 51 | |
| 52 | private: |
| 53 | |
| 54 | Fib& m_managedFib; |
| 55 | function<shared_ptr<Face>(FaceId)> m_getFace; |
Steve DiBenedetto | 43cd037 | 2014-02-01 17:05:07 -0700 | [diff] [blame^] | 56 | std::map<Name, shared_ptr<fw::Strategy> > m_namespaceToStrategyMap; |
Steve DiBenedetto | 042bfe9 | 2014-01-30 15:05:08 -0700 | [diff] [blame] | 57 | |
| 58 | |
| 59 | |
| 60 | typedef function<void(FibManager*, |
| 61 | const Interest&)> VerbProcessor; |
| 62 | |
| 63 | typedef std::map<Name::Component, VerbProcessor> VerbDispatchTable; |
| 64 | |
| 65 | typedef std::pair<Name::Component, VerbProcessor> VerbAndProcessor; |
| 66 | |
| 67 | |
| 68 | const VerbDispatchTable m_verbDispatch; |
| 69 | |
| 70 | static const Name FIB_MANAGER_REQUEST_PREFIX; |
| 71 | static const size_t FIB_MANAGER_REQUEST_COMMAND_MIN_NCOMPS; |
| 72 | static const size_t FIB_MANAGER_REQUEST_SIGNED_INTEREST_NCOMPS; |
| 73 | |
| 74 | static const Name::Component FIB_MANAGER_REQUEST_VERB_INSERT; |
| 75 | static const Name::Component FIB_MANAGER_REQUEST_VERB_DELETE; |
| 76 | static const Name::Component FIB_MANAGER_REQUEST_VERB_ADD_NEXTHOP; |
| 77 | static const Name::Component FIB_MANAGER_REQUEST_VERB_REMOVE_NEXTHOP; |
| 78 | static const Name::Component FIB_MANAGER_REQUEST_VERB_STRATEGY; |
| 79 | |
| 80 | static const VerbAndProcessor FIB_MANAGER_REQUEST_VERBS[]; |
| 81 | |
| 82 | }; |
| 83 | |
| 84 | } // namespace nfd |
| 85 | |
| 86 | #endif // NFD_MGMT_FIB_MANAGER_HPP |