1: 2: 3: /********************* 4: * * 5: * PROJECT INCLUDES * 6: * * 7: *********************/ 8: 9: 10: #include "rdata_name.h" 11: 12: 13: /************************** 14: * * 15: * RDATANAME CONSTRUCTOR * 16: * * 17: **************************/ 18: 19: 20: RDataName::RDataName() { 21: m_llp = NULL; 22: } 23: 24: 25: /***************** 26: * * 27: * METHOD CLONE * 28: * * 29: *****************/ 30: 31: 32: RDataPtr RDataName::Clone() const { 33: RDataName *rdpOut = new RDataName; 34: rdpOut->m_llp = new LabelList(*m_llp); 35: return (RDataPtr)rdpOut; 36: } 37: 38: 39: /******************* 40: * * 41: * METHOD COMPARE * 42: * * 43: *******************/ 44: 45: 46: bool RDataName::Compare(const RData &ci_rdr) const { 47: LabelListConstPtr c_llpFar = ci_rdr.As<RDataName>()->GetRDName(); 48: return ((*c_llpFar)==(*m_llp)); 49: } 50: 51: 52: /**************** 53: * * 54: * METHOD DUMP * 55: * * 56: ****************/ 57: 58: 59: void RDataName::Dump(ostream &io_smr) const { 60: io_smr << this->GetRDName(); 61: } 62: 63: 64: /********************* 65: * * 66: * METHOD GETRDNAME * 67: * * 68: *********************/ 69: 70: 71: LabelListConstPtr RDataName::GetRDName() const { return m_llp; } 72: 73: 74: /******************* 75: * * 76: * METHOD ISMATCH * 77: * * 78: *******************/ 79: 80: 81: bool RDataName::IsMatch(RRType i_ty, RRClass i_cl) { 82: switch(i_ty) { 83: // RFC 1035 "Well Known" types that do not require class IN 84: case TY_NS: 85: case TY_MD: 86: case TY_MF: 87: case TY_CNAME: 88: case TY_MB: 89: case TY_MG: 90: case TY_MR: 91: case TY_PTR: 92: return true; 93: default: break; 94: } 95: // If there were any IN-specific name types, they would go here. 96: return false; 97: } 98: 99: 100: /********************* 101: * * 102: * METHOD READRDATA * 103: * * 104: *********************/ 105: 106: 107: void RDataName::ReadRData(BufferConstPtr ci_dpp) { 108: unsigned short us; 109: 110: ci_dpp->ReadNBO(us); 111: ci_dpp->ReadLabelList(m_llp,true); 112: } 113: 114: 115: /******************** 116: * * 117: * METHOD SETRDATA * 118: * * 119: ********************/ 120: 121: 122: void RDataName::SetRData(const char *ci_strRData) { 123: m_llp = new LabelList(ci_strRData); 124: } 125: 126: 127: /********************** 128: * * 129: * METHOD WRITERDATA * 130: * * 131: **********************/ 132: 133: 134: void RDataName::WriteRData(BufferPtr io_dpp) const { 135: unsigned short us; 136: off_t ofPos; 137: 138: ofPos = io_dpp->GetPos(); 139: io_dpp->WriteNBO((unsigned short)0); 140: us = io_dpp->WriteLabelList(m_llp,true); 141: io_dpp->PWriteNBO(us,ofPos); 142: } 143: 144: 145: /************************* 146: * * 147: * RDATANAME DESTRUCTOR * 148: * * 149: *************************/ 150: 151: 152: RDataName::~RDataName() { 153: SoftDelete(m_llp); 154: } 155: 156: 157: