|
reSIProcate/stack
9694
|
00001 #if defined(HAVE_CONFIG_H) 00002 #include "config.h" 00003 #endif 00004 00005 #include <cassert> 00006 #include "resip/stack/TimerMessage.hxx" 00007 00008 using namespace resip; 00009 00010 TimerMessage::TimerMessage(Data transactionId, Timer::Type type, unsigned long duration) 00011 : mTransactionId(transactionId), 00012 mType(type), 00013 mDuration(duration) {} 00014 00015 const Data& 00016 TimerMessage::getTransactionId() const 00017 { 00018 return mTransactionId; 00019 } 00020 00021 Timer::Type 00022 TimerMessage::getType() const 00023 { 00024 return mType; 00025 } 00026 00027 unsigned long 00028 TimerMessage::getDuration() const 00029 { 00030 return mDuration; 00031 } 00032 00033 TimerMessage::~TimerMessage() 00034 {} 00035 00036 bool 00037 TimerMessage::isClientTransaction() const 00038 { 00039 switch (mType) 00040 { 00041 case Timer::TimerA: 00042 case Timer::TimerB: 00043 case Timer::TimerD: 00044 case Timer::TimerE1: 00045 case Timer::TimerE2: 00046 case Timer::TimerF: 00047 case Timer::TimerK: 00048 case Timer::TimerStaleClient: 00049 case Timer::TimerCleanUp: 00050 case Timer::TimerStateless: 00051 return true; 00052 00053 case Timer::TimerG: 00054 case Timer::TimerH: 00055 case Timer::TimerI: 00056 case Timer::TimerJ: 00057 case Timer::TimerStaleServer: 00058 case Timer::TimerTrying: 00059 return false; 00060 00061 case Timer::TimerC: 00062 assert(0); 00063 break; 00064 00065 default: 00066 assert(0); 00067 break; 00068 } 00069 assert(0); 00070 return false; 00071 } 00072 00073 00074 00075 EncodeStream& 00076 TimerMessage::encodeBrief(EncodeStream& str) const 00077 { 00078 return str << "Timer: " << Timer::toData(mType) << " " << mDuration; 00079 } 00080 00081 EncodeStream& TimerMessage::encode(EncodeStream& strm) const 00082 { 00083 return strm << "TimerMessage TransactionId[" << mTransactionId << "] " 00084 << " Type[" << Timer::toData(mType) << "]" 00085 << " duration[" << mDuration << "]"; 00086 } 00087 00088 /* ==================================================================== 00089 * The Vovida Software License, Version 1.0 00090 * 00091 * Redistribution and use in source and binary forms, with or without 00092 * modification, are permitted provided that the following conditions 00093 * are met: 00094 * 00095 * 1. Redistributions of source code must retain the above copyright 00096 * notice, this list of conditions and the following disclaimer. 00097 * 00098 * 2. Redistributions in binary form must reproduce the above copyright 00099 * notice, this list of conditions and the following disclaimer in 00100 * the documentation and/or other materials provided with the 00101 * distribution. 00102 * 00103 * 3. The names "VOCAL", "Vovida Open Communication Application Library", 00104 * and "Vovida Open Communication Application Library (VOCAL)" must 00105 * not be used to endorse or promote products derived from this 00106 * software without prior written permission. For written 00107 * permission, please contact vocal@vovida.org. 00108 * 00109 * 4. Products derived from this software may not be called "VOCAL", nor 00110 * may "VOCAL" appear in their name, without prior written 00111 * permission of Vovida Networks, Inc. 00112 * 00113 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED 00114 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 00115 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND 00116 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA 00117 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES 00118 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL, 00119 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00120 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00121 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 00122 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00123 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 00124 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 00125 * DAMAGE. 00126 * 00127 * ==================================================================== 00128 * 00129 * This software consists of voluntary contributions made by Vovida 00130 * Networks, Inc. and many individuals on behalf of Vovida Networks, 00131 * Inc. For more information on Vovida Networks, Inc., please see 00132 * <http://www.vovida.org/>. 00133 * 00134 */
1.7.5.1