blob: 2068729daceac8eb948ff54ac199fff41bdb1e3a [file] [log] [blame]
Junxiao Shicbba04c2014-01-26 14:21:22 -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_PIT_FACE_RECORD_HPP
8#define NFD_TABLE_PIT_FACE_RECORD_HPP
9
10#include "face/face.hpp"
11#include "core/time.hpp"
Junxiao Shi408a7002014-02-12 17:53:47 -070012#include "strategy-info-host.hpp"
Junxiao Shicbba04c2014-01-26 14:21:22 -070013
Alexander Afanasyev18bbf812014-01-29 01:40:23 -080014namespace nfd {
Junxiao Shicbba04c2014-01-26 14:21:22 -070015namespace pit {
16
17/** \class FaceRecord
18 * \brief contains information about an Interest
19 * on an incoming or outgoing face
20 * \note This is an implementation detail to extract common functionality
21 * of InRecord and OutRecord
22 */
Junxiao Shi408a7002014-02-12 17:53:47 -070023class FaceRecord : public StrategyInfoHost
Junxiao Shicbba04c2014-01-26 14:21:22 -070024{
25public:
26 explicit
27 FaceRecord(shared_ptr<Face> face);
28
29 FaceRecord(const FaceRecord& other);
30
31 shared_ptr<Face>
32 getFace() const;
33
34 uint32_t
35 getLastNonce() const;
36
37 time::Point
38 getLastRenewed() const;
39
40 /** \brief gives the time point this record expires
41 * \return{ getLastRenewed() + InterestLifetime }
42 */
43 time::Point
44 getExpiry() const;
45
46 /// updates lastNonce, lastRenewed, expiry fields
47 void
48 update(const Interest& interest);
49
50private:
51 shared_ptr<Face> m_face;
52 uint32_t m_lastNonce;
53 time::Point m_lastRenewed;
54 time::Point m_expiry;
55};
56
57inline shared_ptr<Face>
58FaceRecord::getFace() const
59{
60 return m_face;
61}
62
63inline uint32_t
64FaceRecord::getLastNonce() const
65{
66 return m_lastNonce;
67}
68
69inline time::Point
70FaceRecord::getLastRenewed() const
71{
72 return m_lastRenewed;
73}
74
75inline time::Point
76FaceRecord::getExpiry() const
77{
78 return m_expiry;
79}
80
81} // namespace pit
Alexander Afanasyev18bbf812014-01-29 01:40:23 -080082} // namespace nfd
Junxiao Shicbba04c2014-01-26 14:21:22 -070083
84#endif // NFD_TABLE_PIT_FACE_RECORD_HPP