1: // $Id: rrheader.i,v 1.4 2001/10/31 14:40:26 jdw Exp $ 
   2: 
   3: 
   4: /**********************
   5: *                     *
   6: *  COMPILER INCLUDES  *
   7: *                     *
   8: **********************/
   9: 
  10: 
  11: #include <cassert> 
  12: 
  13: 
  14: /*********************
  15: *                    *
  16: *  PROJECT INCLUDES  *
  17: *                    *
  18: *********************/
  19: 
  20: 
  21: #include "dnsutil.h" 
  22: 
  23: 
  24: /****************
  25: *               *
  26: *  GET METHODS  *
  27: *               *   
  28: ****************/   
  29: 
  30: 
  31: inline time_t CacheRRHeader::GetExpire() const { return m_tmExpire; }
  32: inline time_t CacheRRHeader::GetTTL() const { return this->GetTTL(time(NULL)); }
  33: 
  34: 
  35: inline time_t CacheRRHeader::GetTTL(time_t i_tmNow) const {
  36:   if (m_tmExpire <= i_tmNow) return 0;
  37:   return m_tmExpire - i_tmNow;
  38: }
  39: 
  40: 
  41: inline LabelListConstPtr RRHeader::GetName() const { return m_llpName; }
  42: inline unsigned          RRHeader::GetTTL() const { return m_uTTL; }
  43: 
  44: 
  45: /****************
  46: *               *
  47: *  SET METHODS  *
  48: *               *
  49: ****************/
  50: 
  51: 
  52: inline void CacheRRHeader::SetTTL(unsigned i_uTTL) {
  53:   m_tmExpire = time(NULL) + i_uTTL;
  54: }
  55: 
  56: 
  57: inline void RRHeader::SetName(LabelListPtr &i_llpr) { m_llpName = i_llpr; i_llpr = NULL; }
  58: inline void RRHeader::SetTTL(unsigned i_uTTL) { m_uTTL = i_uTTL; }
  59: 
  60: 
  61: /*********************
  62: *                    *
  63: *  METHOD ISEXPIRED  *
  64: *                    *
  65: *********************/
  66: 
  67: 
  68: inline bool CacheRRHeader::IsExpired(time_t i_tmNow) const {
  69:   if (m_tmExpire <= i_tmNow) return true;
  70:   return false;
  71: }
  72: 
  73: 
  74: