blob: 59a242b7fca9d66a9df8f673a294091887045c00 [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"
12#include "mgmt/manager-base.hpp"
13
14namespace nfd {
15
16class AppFace;
17class Face;
18class Strategy;
19class Forwarder;
20class Fib;
21
22class FibManager : public ManagerBase
23{
24public:
25
Steve DiBenedetto3970c892014-01-31 23:31:13 -070026 FibManager(Fib& fib,
27 function<shared_ptr<Face>(FaceId)> getFace,
28 shared_ptr<AppFace> face);
Steve DiBenedetto042bfe92014-01-30 15:05:08 -070029
30 void
31 onFibRequest(const Interest& request);
32
33 const Name&
34 getRequestPrefix() const { return FIB_MANAGER_REQUEST_PREFIX; }
35
36private:
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
56private:
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