1: 
   2: 
   3: /**********************
   4: *                     *
   5: *  COMPILER INCLUDES  *
   6: *                     *
   7: **********************/
   8: 
   9: 
  10: #include <cassert> 
  11: 
  12: 
  13: /*********************
  14: *                    *
  15: *  PROJECT INCLUDES  *
  16: *                    *
  17: *********************/
  18: 
  19: 
  20: #include "rrfactory.h" 
  21: 
  22: 
  23: /***********************
  24: *                      *
  25: *  METHODS NEWCACHERR  *
  26: *                      *
  27: ***********************/
  28: 
  29: 
  30: CacheRRPtr RRFactory::NewCacheRR(RRType i_ty, RRClass i_cl, unsigned i_uTTL, const char *ci_strRData) {
  31:   CacheRRPtr crpOut = new CacheRR;
  32:   RDataPtr rdp;
  33: 
  34:   crpOut->SetTTL(i_uTTL);
  35:   crpOut->SetType(i_ty);
  36:   crpOut->SetClass(i_cl);
  37:   
  38:   rdp = RData::New(i_ty,i_cl);
  39:   rdp->SetRData(ci_strRData);
  40:   crpOut->SetRData(rdp);
  41:   return crpOut;
  42: }
  43: 
  44: 
  45: CacheRRPtr RRFactory::NewCacheRR(RRType i_ty, RRClass i_cl, unsigned i_uTTL, RDataPtr &i_rdp) {
  46:   CacheRRPtr crpOut = new CacheRR;
  47: 
  48:   crpOut->SetTTL(i_uTTL);
  49:   crpOut->SetType(i_ty);
  50:   crpOut->SetClass(i_cl);
  51:   crpOut->SetRData(i_rdp);
  52:   return crpOut;
  53: }
  54: 
  55: 
  56: CacheRRPtr RRFactory::NewCacheRR(RRConstPtr ci_rrp) {
  57:   CacheRRPtr crpOut = new CacheRR;
  58:   RDataPtr rdp;
  59: 
  60:   crpOut->SetTTL(ci_rrp->GetTTL());
  61:   crpOut->SetType(ci_rrp->GetType());
  62:   crpOut->SetClass(ci_rrp->GetClass());
  63:   rdp = ci_rrp->GetRData()->Clone();
  64:   crpOut->SetRData(rdp);
  65:   return crpOut;
  66: }
  67: 
  68: 
  69: /******************
  70: *                 *
  71: *  METHODS NEWRR  *
  72: *                 *
  73: ******************/
  74: 
  75: 
  76: RRPtr RRFactory::NewRR(LabelListPtr &i_llprName, RRType i_ty, RRClass i_cl, unsigned i_uTTL, RDataPtr &i_rdpr) {
  77:   RRPtr rrpOut;
  78: 
  79:   rrpOut = new RR;
  80:   rrpOut->SetName(i_llprName);
  81:   i_llprName = NULL;
  82:   rrpOut->SetTTL(i_uTTL);
  83:   rrpOut->SetType(i_ty);
  84:   rrpOut->SetClass(i_cl);
  85:   rrpOut->SetRData(i_rdpr);
  86:   i_rdpr = NULL;
  87:   return rrpOut;
  88: }
  89: 
  90: 
  91: RRPtr RRFactory::NewRR(LabelListPtr &i_llrpName, CacheRRConstPtr ci_crp) {
  92:   RRPtr rrpOut = new RR;
  93:   RDataPtr rdp;
  94: 
  95:   rrpOut->SetName(i_llrpName);
  96:   rrpOut->SetTTL(ci_crp->GetTTL());
  97:   rrpOut->SetType(ci_crp->GetType());
  98:   rrpOut->SetClass(ci_crp->GetClass());
  99:   rdp = ci_crp->GetRData()->Clone();
 100:   rrpOut->SetRData(rdp);
 101:   return rrpOut;
 102: }
 103: 
 104: 
 105: RRPtr RRFactory::NewRR(RRConstPtr ci_rrp) {
 106:   RRPtr rrpOut = new RR;
 107:   LabelListPtr llp;
 108:   RDataPtr rdp;
 109: 
 110:   llp = new LabelList(*ci_rrp->GetName());
 111: 
 112:   rrpOut->SetName(llp);
 113:   rrpOut->SetTTL(ci_rrp->GetTTL());
 114:   rrpOut->SetType(ci_rrp->GetType());
 115:   rrpOut->SetClass(ci_rrp->GetClass());
 116:   rdp = ci_rrp->GetRData()->Clone();
 117:   rrpOut->SetRData(rdp);
 118:   return rrpOut;
 119: }
 120: 
 121: 
 122: