#ifndef NLSR_FIB_HPP
#define NLSR_FIB_HPP

#include <list>
#include "nlsr_fe.hpp"

namespace nlsr
{

  class Nlsr;

  using namespace std;
  using namespace ndn;

  class Fib
  {
  public:
    Fib()
      : m_table()
      , m_refreshTime(0)
    {
    }

    void remove(Nlsr& pnlsr, string name);
    void update(Nlsr& pnlsr, string name, Nhl& nextHopList);
    void clean(Nlsr& pnlsr);
    void setEntryRefreshTime(int fert)
    {
      m_refreshTime=fert;
    }

    void print();

  private:
    void removeHop(Nlsr& pnlsr, Nhl& nl, int doNotRemoveHopFaceId);
    int getNumberOfFacesForName(Nhl& nextHopList, int maxFacesPerPrefix);
    ndn::EventId
    scheduleEntryRefreshing(Nlsr& pnlsr, string name, int feSeqNum,
                               int refreshTime);
    void cancelScheduledExpiringEvent(Nlsr& pnlsr, EventId eid);
    void refreshEntry(string name, int feSeqNum);

  private:
    std::list<FibEntry> m_table;
    int m_refreshTime;
  };

}//namespace nlsr
#endif
