|
reSIProcate/rutil
9694
|
00001 #ifndef RESIP_DNS_NAPTR_RECORD 00002 #define RESIP_DNS_NAPTR_RECORD 00003 00004 #include "rutil/Data.hxx" 00005 #include "rutil/Socket.hxx" 00006 #include "rutil/BaseException.hxx" 00007 #include "rutil/dns/DnsResourceRecord.hxx" 00008 00009 namespace resip 00010 { 00011 00012 class Data; 00013 class DnsResourceRecord; 00014 class RROverlay; 00015 class BaseException; 00016 00017 class DnsNaptrRecord : public DnsResourceRecord 00018 { 00019 public: 00020 class NaptrException : public BaseException 00021 { 00022 public: 00023 NaptrException(const Data& msg, const Data& file, const int line) 00024 : BaseException(msg, file, line) 00025 { 00026 } 00027 00028 const char* name() const { return "NaptrException"; } 00029 }; 00030 00031 class RegExp 00032 { 00033 public: 00034 // Takes a regexp expression as defined in rfc 2915 (section 3 00035 // Substitution Expression Grammar) The delimiter is whatever 00036 // appears in the first character. This can be empty. 00037 RegExp(const Data& data); 00038 RegExp(); 00039 ~RegExp(); 00040 00041 bool empty() const; 00042 00043 // Convenience method provided for access to the antecedent of the 00044 // regexp (the matching regular expression) 00045 const Data& regexp() const; 00046 00047 // Convenience method provided for access to the consequent of the 00048 // regexp (the replacement) - this must be a URI 00049 const Data& replacement() const; 00050 00051 // Applies the regular expression substitution based on the input 00052 // string. Will return Data::Empty if the input does not match the 00053 // substitution. 00054 Data apply(const Data& input) const; 00055 00056 private: 00057 Data mRegexp; 00058 Data mReplacement; 00059 Data flags; 00060 //regex_t mRe; 00061 }; 00062 00063 00064 DnsNaptrRecord() : mOrder(-1), mPreference(-1) {} 00065 DnsNaptrRecord(const RROverlay&); 00066 ~DnsNaptrRecord() {} 00067 00068 // accessors. 00069 int order() const { return mOrder; } 00070 int& order() { return mOrder; } 00071 int preference() const { return mPreference; } 00072 const Data& flags() const { return mFlags; } 00073 const Data& service() const { return mService; } 00074 const RegExp& regexp() const { return mRegexp; } 00075 const Data& replacement() const { return mReplacement; } 00076 const Data& name() const { return mName; } 00077 bool isSameValue(const Data& value) const; 00078 EncodeStream& dump(EncodeStream& strm) const; 00079 00080 private: 00081 int mOrder; 00082 int mPreference; 00083 Data mFlags; 00084 Data mService; 00085 RegExp mRegexp; 00086 Data mReplacement; 00087 Data mName; 00088 00089 }; 00090 00091 } 00092 00093 00094 #endif 00095 00096 /* ==================================================================== 00097 * The Vovida Software License, Version 1.0 00098 * 00099 * Copyright (c) 2000-2005 Vovida Networks, Inc. All rights reserved. 00100 * 00101 * Redistribution and use in source and binary forms, with or without 00102 * modification, are permitted provided that the following conditions 00103 * are met: 00104 * 00105 * 1. Redistributions of source code must retain the above copyright 00106 * notice, this list of conditions and the following disclaimer. 00107 * 00108 * 2. Redistributions in binary form must reproduce the above copyright 00109 * notice, this list of conditions and the following disclaimer in 00110 * the documentation and/or other materials provided with the 00111 * distribution. 00112 * 00113 * 3. The names "VOCAL", "Vovida Open Communication Application Library", 00114 * and "Vovida Open Communication Application Library (VOCAL)" must 00115 * not be used to endorse or promote products derived from this 00116 * software without prior written permission. For written 00117 * permission, please contact vocal@vovida.org. 00118 * 00119 * 4. Products derived from this software may not be called "VOCAL", nor 00120 * may "VOCAL" appear in their name, without prior written 00121 * permission of Vovida Networks, Inc. 00122 * 00123 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED 00124 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 00125 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND 00126 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA 00127 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES 00128 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL, 00129 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00130 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00131 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 00132 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00133 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 00134 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 00135 * DAMAGE. 00136 * 00137 * ==================================================================== 00138 * 00139 * This software consists of voluntary contributions made by Vovida 00140 * Networks, Inc. and many individuals on behalf of Vovida Networks, 00141 * Inc. For more information on Vovida Networks, Inc., please see 00142 * <http://www.vovida.org/>. 00143 * 00144 */
1.7.5.1