1: 
   2: 
   3: /*********************
   4: *                    *
   5: *  PROJECT INCLUDES  *
   6: *                    *
   7: *********************/
   8: 
   9: 
  10: #include "ex.h" 
  11: #include "rdata_mx.h" 
  12: 
  13: 
  14: /************************
  15: *                       *
  16: *  RDATAMX CONSTRUCTOR  *
  17: *                       *
  18: ************************/
  19: 
  20: 
  21: RDataMX::RDataMX() {
  22:   m_llp = NULL;
  23: }
  24: 
  25: 
  26: /*****************
  27: *                *
  28: *  METHOD CLONE  *
  29: *                *
  30: *****************/
  31: 
  32: 
  33: RDataPtr RDataMX::Clone() const {
  34:   RDataMX *rdpOut = new RDataMX;
  35:   rdpOut->m_llp = new LabelList(*m_llp);
  36:   return (RDataPtr)rdpOut;
  37: }
  38: 
  39: 
  40: /*******************
  41: *                  *
  42: *  METHOD COMPARE  *
  43: *                  *
  44: *******************/
  45: 
  46: 
  47: bool RDataMX::Compare(const RData &ci_rdr) const {
  48:   const RDataMX *c_rdp = ci_rdr.As<RDataMX>();
  49:   if (c_rdp->m_us!=m_us) return false;
  50:   return (*(c_rdp->m_llp)==(*m_llp));
  51: }
  52: 
  53:  
  54: /****************
  55: *               *
  56: *  METHOD DUMP  *
  57: *               *
  58: ****************/
  59: 
  60: 
  61: void RDataMX::Dump(ostream &io_smr) const {
  62:   io_smr << m_us << " " << m_llp;
  63: }
  64: 
  65: 
  66: /*******************
  67: *                  *
  68: *  METHOD ISMATCH  *
  69: *                  *
  70: *******************/
  71: 
  72: 
  73: bool RDataMX::IsMatch(RRType i_ty, RRClass i_cl) {
  74:   // RFC 1035 says this is class-independent.
  75:   return (i_ty==TY_MX);
  76: }
  77: 
  78: 
  79: /*********************
  80: *                    *
  81: *  METHOD READRDATA  *
  82: *                    *
  83: *********************/
  84: 
  85: 
  86: void RDataMX::ReadRData(BufferConstPtr ci_dpp) {
  87:   unsigned short usLength;
  88: 
  89:   ci_dpp->ReadNBO(usLength);
  90:   ci_dpp->ReadNBO(m_us);
  91:   ci_dpp->ReadLabelList(m_llp,true);
  92: }
  93: 
  94: 
  95: /********************
  96: *                   *
  97: *  METHOD SETRDATA  *
  98: *                   *
  99: ********************/
 100: 
 101: 
 102: void RDataMX::SetRData(const char *ci_strRData) {
 103:   EX_MIND("RDataMX::SetRData: I was too lazy too implement this.");
 104: }
 105: 
 106: 
 107: /**********************
 108: *                     *
 109: *  METHOD WRITERDATA  *
 110: *                     *
 111: **********************/
 112: 
 113: 
 114: void RDataMX::WriteRData(BufferPtr io_dpp) const {
 115:   unsigned short usLength;
 116:   off_t ofPos;
 117: 
 118:   ofPos = io_dpp->GetPos();
 119:   io_dpp->WriteNBO((unsigned short)0);
 120:   io_dpp->WriteNBO(m_us);
 121:   usLength = io_dpp->WriteLabelList(m_llp,true) + sizeof(m_us);
 122:   io_dpp->PWriteNBO(usLength,ofPos);
 123: }
 124: 
 125: 
 126: /***********************
 127: *                      *
 128: *  RDATAMX DESTRUCTOR  *
 129: *                      *
 130: ***********************/
 131: 
 132: 
 133: RDataMX::~RDataMX() {
 134:   SoftDelete(m_llp);
 135: }
 136: 
 137: 
 138: