blob: b3396705e7c79540244cc398019c006e598b63e2 [file] [log] [blame]
akmhoque3d06e792014-05-27 16:23:20 -05001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
Nick Gordonf8b5bcd2016-08-11 15:06:50 -05003 * Copyright (c) 2014-2016, The University of Memphis,
4 * Regents of the University of California
akmhoque3d06e792014-05-27 16:23:20 -05005 *
6 * This file is part of NLSR (Named-data Link State Routing).
7 * See AUTHORS.md for complete list of NLSR authors and contributors.
8 *
9 * NLSR is free software: you can redistribute it and/or modify it under the terms
10 * of the GNU General Public License as published by the Free Software Foundation,
11 * either version 3 of the License, or (at your option) any later version.
12 *
13 * NLSR is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
14 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along with
18 * NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
19 *
20 * \author A K M Mahmudul Hoque <ahoque1@memphis.edu>
21 *
22 **/
akmhoquefdbddb12014-05-02 18:35:19 -050023#ifndef NLSR_FIB_ENTRY_HPP
24#define NLSR_FIB_ENTRY_HPP
akmhoque53353462014-04-22 08:43:45 -050025
26#include <list>
27#include <iostream>
akmhoquefdbddb12014-05-02 18:35:19 -050028#include <boost/cstdint.hpp>
29
akmhoquec8a10f72014-04-25 18:42:55 -050030#include <ndn-cxx/util/scheduler.hpp>
akmhoquec7a79b22014-05-26 08:06:19 -050031#include <ndn-cxx/util/time.hpp>
akmhoque53353462014-04-22 08:43:45 -050032
33#include "nexthop.hpp"
akmhoquec8a10f72014-04-25 18:42:55 -050034#include "nexthop-list.hpp"
akmhoque53353462014-04-22 08:43:45 -050035
36namespace nlsr {
37
akmhoque53353462014-04-22 08:43:45 -050038class FibEntry
39{
40public:
41 FibEntry()
42 : m_name()
akmhoquec7a79b22014-05-26 08:06:19 -050043 , m_expirationTimePoint()
akmhoque53353462014-04-22 08:43:45 -050044 , m_seqNo(0)
akmhoquefdbddb12014-05-02 18:35:19 -050045 , m_nexthopList()
akmhoque53353462014-04-22 08:43:45 -050046 {
47 }
48
akmhoque31d1d4b2014-05-05 22:08:14 -050049 FibEntry(const ndn::Name& name)
akmhoquec7a79b22014-05-26 08:06:19 -050050 : m_expirationTimePoint()
akmhoque53353462014-04-22 08:43:45 -050051 , m_seqNo(0)
akmhoquefdbddb12014-05-02 18:35:19 -050052 , m_nexthopList()
akmhoque53353462014-04-22 08:43:45 -050053 {
akmhoquefdbddb12014-05-02 18:35:19 -050054 m_name = name;
akmhoque53353462014-04-22 08:43:45 -050055 }
56
akmhoque31d1d4b2014-05-05 22:08:14 -050057 const ndn::Name&
akmhoque53353462014-04-22 08:43:45 -050058 getName() const
59 {
60 return m_name;
61 }
62
akmhoquec8a10f72014-04-25 18:42:55 -050063 NexthopList&
akmhoquefdbddb12014-05-02 18:35:19 -050064 getNexthopList()
akmhoque53353462014-04-22 08:43:45 -050065 {
akmhoquefdbddb12014-05-02 18:35:19 -050066 return m_nexthopList;
akmhoque53353462014-04-22 08:43:45 -050067 }
68
akmhoquec7a79b22014-05-26 08:06:19 -050069 const ndn::time::system_clock::TimePoint&
70 getExpirationTimePoint() const
akmhoque53353462014-04-22 08:43:45 -050071 {
akmhoquec7a79b22014-05-26 08:06:19 -050072 return m_expirationTimePoint;
akmhoque53353462014-04-22 08:43:45 -050073 }
74
75 void
akmhoquec7a79b22014-05-26 08:06:19 -050076 setExpirationTimePoint(const ndn::time::system_clock::TimePoint& ttr)
akmhoque53353462014-04-22 08:43:45 -050077 {
akmhoquec7a79b22014-05-26 08:06:19 -050078 m_expirationTimePoint = ttr;
akmhoque53353462014-04-22 08:43:45 -050079 }
80
81 void
82 setExpiringEventId(ndn::EventId feid)
83 {
84 m_expiringEventId = feid;
85 }
86
87 ndn::EventId
88 getExpiringEventId() const
89 {
90 return m_expiringEventId;
91 }
92
93 void
akmhoquefdbddb12014-05-02 18:35:19 -050094 setSeqNo(int32_t fsn)
akmhoque53353462014-04-22 08:43:45 -050095 {
96 m_seqNo = fsn;
97 }
98
akmhoquefdbddb12014-05-02 18:35:19 -050099 int32_t
akmhoque53353462014-04-22 08:43:45 -0500100 getSeqNo()
101 {
102 return m_seqNo;
103 }
104
akmhoque674b0b12014-05-20 14:33:28 -0500105 void
106 writeLog();
107
akmhoque53353462014-04-22 08:43:45 -0500108private:
akmhoque31d1d4b2014-05-05 22:08:14 -0500109 ndn::Name m_name;
akmhoquec7a79b22014-05-26 08:06:19 -0500110 ndn::time::system_clock::TimePoint m_expirationTimePoint;
akmhoque53353462014-04-22 08:43:45 -0500111 ndn::EventId m_expiringEventId;
akmhoquefdbddb12014-05-02 18:35:19 -0500112 int32_t m_seqNo;
113 NexthopList m_nexthopList;
akmhoque53353462014-04-22 08:43:45 -0500114};
115
Nick Gordonfad8e252016-08-11 14:21:38 -0500116} // namespace nlsr
akmhoque53353462014-04-22 08:43:45 -0500117
akmhoquefdbddb12014-05-02 18:35:19 -0500118#endif //NLSR_FIB_ENTRY_HPP