blob: a0de2fc5909440fc2353cfe5a2e053e53b9e232e [file] [log] [blame]
Steve DiBenedetto042bfe92014-01-30 15:05:08 -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#ifndef NFD_MGMT_FIB_MANAGER_HPP
8#define NFD_MGMT_FIB_MANAGER_HPP
9
10#include "common.hpp"
11#include "face/face.hpp"
Steve DiBenedetto43cd0372014-02-01 17:05:07 -070012#include "mgmt/app-face.hpp"
13#include "fw/strategy.hpp"
Steve DiBenedetto042bfe92014-01-30 15:05:08 -070014#include "mgmt/manager-base.hpp"
15
16namespace nfd {
17
Steve DiBenedetto042bfe92014-01-30 15:05:08 -070018class Forwarder;
19class Fib;
20
21class FibManager : public ManagerBase
22{
23public:
24
Steve DiBenedetto3970c892014-01-31 23:31:13 -070025 FibManager(Fib& fib,
26 function<shared_ptr<Face>(FaceId)> getFace,
27 shared_ptr<AppFace> face);
Steve DiBenedetto042bfe92014-01-30 15:05:08 -070028
29 void
30 onFibRequest(const Interest& request);
31
Steve DiBenedetto042bfe92014-01-30 15:05:08 -070032private:
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
52private:
53
54 Fib& m_managedFib;
55 function<shared_ptr<Face>(FaceId)> m_getFace;
Steve DiBenedetto43cd0372014-02-01 17:05:07 -070056 std::map<Name, shared_ptr<fw::Strategy> > m_namespaceToStrategyMap;
Steve DiBenedetto042bfe92014-01-30 15:05:08 -070057
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