blob: 67f50560fd3879a3fcaa60c83115f9d637efbd71 [file] [log] [blame]
Junxiao Shic1e12362014-01-24 20:03:26 -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_TABLE_FIB_ENTRY_HPP
8#define NFD_TABLE_FIB_ENTRY_HPP
9
10#include "fib-nexthop.hpp"
11
12namespace ndn {
13namespace fib {
14
15/** \class NextHopList
16 * \brief represents a collection of nexthops
17 * This type has these methods:
18 * iterator<NextHop> begin()
19 * iterator<NextHop> end()
20 * size_t size()
21 */
22typedef std::vector<fib::NextHop> NextHopList;
23
24/** \class Entry
25 * \brief represents a FIB entry
26 */
27class Entry : noncopyable
28{
29public:
30 Entry(const Name& prefix);
31
32 const Name&
33 getPrefix() const;
34
35 /** \brief gives the nexthops explicitly defined on this entry
36 * This list does not include inherited nexthops.
37 */
38 const NextHopList&
39 getNextHops() const;
40
41 /// adds a nexthop
42 void
43 addNextHop(shared_ptr<Face> face, int32_t cost);
44
45 /// removes a nexthop
46 void
47 removeNextHop(shared_ptr<Face> face);
48
49private:
50 /// sorts the nexthop list
51 void
52 sortNextHops();
53
54private:
55 Name m_prefix;
56 NextHopList m_nextHops;
57};
58
59
60inline const Name&
61Entry::getPrefix() const
62{
63 return m_prefix;
64}
65
66inline const NextHopList&
67Entry::getNextHops() const
68{
69 return m_nextHops;
70}
71
72
73} // namespace fib
74} // namespace ndn
75
76#endif // NFD_TABLE_FIB_ENTRY_HPP