|
reSIProcate/rutil
9694
|
00001 #if defined(HAVE_CONFIG_H) 00002 #include "config.h" 00003 #endif 00004 00005 #include <stdlib.h> 00006 00007 #include "AresCompat.hxx" 00008 00009 #ifndef __CYGWIN__ 00010 #ifndef RRFIXEDSZ 00011 #define RRFIXEDSZ 10 00012 #endif 00013 #ifndef NS_RRFIXEDSZ 00014 #define NS_RRFIXEDSZ 10 00015 #endif 00016 #endif 00017 00018 #include "rutil/Data.hxx" 00019 #include "rutil/BaseException.hxx" 00020 #include "RROverlay.hxx" 00021 #include "DnsResourceRecord.hxx" 00022 #include "DnsCnameRecord.hxx" 00023 00024 using namespace resip; 00025 00026 DnsCnameRecord::DnsCnameRecord(const RROverlay& overlay) 00027 { 00028 char* name = 0; 00029 long len = 0; 00030 if (ARES_SUCCESS != ares_expand_name(overlay.data()-overlay.nameLength()-RRFIXEDSZ, overlay.msg(), overlay.msgLength(), &name, &len)) 00031 { 00032 throw CnameException("Failed parse of CNAME record", __FILE__, __LINE__); 00033 } 00034 mName = name; 00035 free(name); 00036 00037 if (ARES_SUCCESS != ares_expand_name(overlay.data(), overlay.msg(), overlay.msgLength(), &name, &len)) 00038 { 00039 throw CnameException("Failed parse of CNAME record", __FILE__, __LINE__); 00040 } 00041 00042 mCname = name; 00043 free(name); 00044 } 00045 00046 bool DnsCnameRecord::isSameValue(const Data& value) const 00047 { 00048 return mCname==value; 00049 } 00050 00051 EncodeStream& 00052 DnsCnameRecord::dump(EncodeStream& strm) const 00053 { 00054 strm << mName << " (CNAME) --> " << mCname; 00055 return strm; 00056 } 00057 00058 /* ==================================================================== 00059 * The Vovida Software License, Version 1.0 00060 * 00061 * Copyright (c) 2000-2005 Vovida Networks, Inc. All rights reserved. 00062 * 00063 * Redistribution and use in source and binary forms, with or without 00064 * modification, are permitted provided that the following conditions 00065 * are met: 00066 * 00067 * 1. Redistributions of source code must retain the above copyright 00068 * notice, this list of conditions and the following disclaimer. 00069 * 00070 * 2. Redistributions in binary form must reproduce the above copyright 00071 * notice, this list of conditions and the following disclaimer in 00072 * the documentation and/or other materials provided with the 00073 * distribution. 00074 * 00075 * 3. The names "VOCAL", "Vovida Open Communication Application Library", 00076 * and "Vovida Open Communication Application Library (VOCAL)" must 00077 * not be used to endorse or promote products derived from this 00078 * software without prior written permission. For written 00079 * permission, please contact vocal@vovida.org. 00080 * 00081 * 4. Products derived from this software may not be called "VOCAL", nor 00082 * may "VOCAL" appear in their name, without prior written 00083 * permission of Vovida Networks, Inc. 00084 * 00085 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED 00086 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 00087 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND 00088 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA 00089 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES 00090 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL, 00091 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00092 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00093 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 00094 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00095 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 00096 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 00097 * DAMAGE. 00098 * 00099 * ==================================================================== 00100 * 00101 * This software consists of voluntary contributions made by Vovida 00102 * Networks, Inc. and many individuals on behalf of Vovida Networks, 00103 * Inc. For more information on Vovida Networks, Inc., please see 00104 * <http://www.vovida.org/>. 00105 * 00106 */ 00107
1.7.5.1