|
reSIProcate/repro
9694
|
00001 #include "repro/QValueTarget.hxx" 00002 #include "rutil/WinLeakCheck.hxx" 00003 00004 00005 namespace repro 00006 { 00007 00008 static int DefaultPriorityMetric = 1000; // If no q-value is present, when we treat the target as having a 1.0 priority 00009 00010 QValueTarget::QValueTarget(const resip::Uri& target) : 00011 Target(target) 00012 { 00013 // Note: no neeed to call storePriorityMetric(), since q value parameter 00014 // is a NameAddr parameter and all we have here is a URI 00015 } 00016 00017 QValueTarget::QValueTarget(const resip::NameAddr& target) : 00018 Target(target) 00019 { 00020 storePriorityMetric(); 00021 } 00022 00023 QValueTarget::QValueTarget(const resip::ContactInstanceRecord& rec) : 00024 Target(rec) 00025 { 00026 storePriorityMetric(); 00027 } 00028 00029 QValueTarget::~QValueTarget() 00030 { 00031 } 00032 00033 QValueTarget* 00034 QValueTarget::clone() const 00035 { 00036 return new QValueTarget(*this); 00037 } 00038 00039 void 00040 QValueTarget::storePriorityMetric() 00041 { 00042 if(mRec.mContact.exists(resip::p_q)) 00043 { 00044 try 00045 { 00046 mPriorityMetric=mRec.mContact.param(resip::p_q); 00047 } 00048 catch(resip::ParseBuffer::Exception& /*e*/) 00049 { 00050 mPriorityMetric=DefaultPriorityMetric; 00051 } 00052 } 00053 else 00054 { 00055 mPriorityMetric=DefaultPriorityMetric; 00056 } 00057 } 00058 00059 } 00060 00061 /* ==================================================================== 00062 * The Vovida Software License, Version 1.0 00063 * 00064 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved. 00065 * 00066 * Redistribution and use in source and binary forms, with or without 00067 * modification, are permitted provided that the following conditions 00068 * are met: 00069 * 00070 * 1. Redistributions of source code must retain the above copyright 00071 * notice, this list of conditions and the following disclaimer. 00072 * 00073 * 2. Redistributions in binary form must reproduce the above copyright 00074 * notice, this list of conditions and the following disclaimer in 00075 * the documentation and/or other materials provided with the 00076 * distribution. 00077 * 00078 * 3. The names "VOCAL", "Vovida Open Communication Application Library", 00079 * and "Vovida Open Communication Application Library (VOCAL)" must 00080 * not be used to endorse or promote products derived from this 00081 * software without prior written permission. For written 00082 * permission, please contact vocal@vovida.org. 00083 * 00084 * 4. Products derived from this software may not be called "VOCAL", nor 00085 * may "VOCAL" appear in their name, without prior written 00086 * permission of Vovida Networks, Inc. 00087 * 00088 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED 00089 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 00090 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND 00091 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA 00092 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES 00093 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL, 00094 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00095 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00096 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 00097 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00098 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 00099 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 00100 * DAMAGE. 00101 * 00102 * ==================================================================== 00103 */
1.7.5.1