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