blob: 214b426c83385991ece2af7ad2f76bff50e45ba8 [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
26 FibManager(Fib& fib, function<shared_ptr<Face>(FaceId)> getFace);
27
28 void
29 onFibRequest(const Interest& request);
30
31 const Name&
32 getRequestPrefix() const { return FIB_MANAGER_REQUEST_PREFIX; }
33
34private:
35
36 void
37 fibInsert(const Interest& request);
38
39 void
40 fibDelete(const Interest& request);
41
42 void
43 fibAddNextHop(const Interest& request);
44
45 void
46 fibRemoveNextHop(const Interest& request);
47
48 void
49 fibStrategy(const Interest& request);
50
51 // void
52 // onConfig(ConfigFile::Node section, bool isDryRun);
53
54private:
55
56 Fib& m_managedFib;
57 function<shared_ptr<Face>(FaceId)> m_getFace;
58 std::map<Name, shared_ptr<Strategy> > m_namespaceToStrategyMap;
59
60
61
62 typedef function<void(FibManager*,
63 const Interest&)> VerbProcessor;
64
65 typedef std::map<Name::Component, VerbProcessor> VerbDispatchTable;
66
67 typedef std::pair<Name::Component, VerbProcessor> VerbAndProcessor;
68
69
70 const VerbDispatchTable m_verbDispatch;
71
72 static const Name FIB_MANAGER_REQUEST_PREFIX;
73 static const size_t FIB_MANAGER_REQUEST_COMMAND_MIN_NCOMPS;
74 static const size_t FIB_MANAGER_REQUEST_SIGNED_INTEREST_NCOMPS;
75
76 static const Name::Component FIB_MANAGER_REQUEST_VERB_INSERT;
77 static const Name::Component FIB_MANAGER_REQUEST_VERB_DELETE;
78 static const Name::Component FIB_MANAGER_REQUEST_VERB_ADD_NEXTHOP;
79 static const Name::Component FIB_MANAGER_REQUEST_VERB_REMOVE_NEXTHOP;
80 static const Name::Component FIB_MANAGER_REQUEST_VERB_STRATEGY;
81
82 static const VerbAndProcessor FIB_MANAGER_REQUEST_VERBS[];
83
84};
85
86} // namespace nfd
87
88#endif // NFD_MGMT_FIB_MANAGER_HPP