blob: 89aef1ed58b35779c5db90de599e9ab138a4a67e [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#include "pit-face-record.hpp"
8
9namespace ndn {
10namespace pit {
11
12FaceRecord::FaceRecord(shared_ptr<Face> face)
13 : m_face(face)
14 , m_lastNonce(0)
15 , m_lastRenewed(0)
16 , m_expiry(0)
17{
18}
19
20FaceRecord::FaceRecord(const FaceRecord& other)
21 : m_face(other.m_face)
22 , m_lastNonce(other.m_lastNonce)
23 , m_lastRenewed(other.m_lastRenewed)
24 , m_expiry(other.m_expiry)
25{
26}
27
28void
29FaceRecord::update(const Interest& interest)
30{
31 m_lastNonce = interest.getNonce();
32 m_lastRenewed = time::now();
33 m_expiry = m_lastRenewed + time::milliseconds(interest.getInterestLifetime());
34}
35
36
37} // namespace pit
38} // namespace ndn