blob: d2dfe2ce7df45318977556c9a31cf77c77047534 [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"
12
13namespace ndn {
14namespace pit {
15
16/** \class FaceRecord
17 * \brief contains information about an Interest
18 * on an incoming or outgoing face
19 * \note This is an implementation detail to extract common functionality
20 * of InRecord and OutRecord
21 */
22class FaceRecord
23{
24public:
25 explicit
26 FaceRecord(shared_ptr<Face> face);
27
28 FaceRecord(const FaceRecord& other);
29
30 shared_ptr<Face>
31 getFace() const;
32
33 uint32_t
34 getLastNonce() const;
35
36 time::Point
37 getLastRenewed() const;
38
39 /** \brief gives the time point this record expires
40 * \return{ getLastRenewed() + InterestLifetime }
41 */
42 time::Point
43 getExpiry() const;
44
45 /// updates lastNonce, lastRenewed, expiry fields
46 void
47 update(const Interest& interest);
48
49private:
50 shared_ptr<Face> m_face;
51 uint32_t m_lastNonce;
52 time::Point m_lastRenewed;
53 time::Point m_expiry;
54};
55
56inline shared_ptr<Face>
57FaceRecord::getFace() const
58{
59 return m_face;
60}
61
62inline uint32_t
63FaceRecord::getLastNonce() const
64{
65 return m_lastNonce;
66}
67
68inline time::Point
69FaceRecord::getLastRenewed() const
70{
71 return m_lastRenewed;
72}
73
74inline time::Point
75FaceRecord::getExpiry() const
76{
77 return m_expiry;
78}
79
80} // namespace pit
81} // namespace ndn
82
83#endif // NFD_TABLE_PIT_FACE_RECORD_HPP