reSIProcate/DialogUsageManager  9680
DumTimeout.cxx
Go to the documentation of this file.
00001 #include <cassert>
00002 #include "DumTimeout.hxx"
00003 #include "rutil/WinLeakCheck.hxx"
00004 #include "resip/dum/BaseUsage.hxx"
00005 
00006 using namespace resip;
00007 
00008 DumTimeout::DumTimeout(Type type, 
00009                        unsigned long duration, 
00010                        BaseUsageHandle targetBu, 
00011                        unsigned int seq, 
00012                        unsigned int altSeq,
00013                        const Data &transactionId)
00014     : mType(type),
00015       mDuration(duration),
00016       mUsageHandle(targetBu),
00017       mSeq(seq),
00018       mSecondarySeq(altSeq),
00019       mTransactionId(transactionId)
00020 {}
00021 
00022 DumTimeout::DumTimeout(const DumTimeout& source)
00023     : mType(source.mType),
00024       mDuration(source.mDuration),
00025       mUsageHandle(source.mUsageHandle),
00026       mSeq(source.mSeq),
00027       mSecondarySeq(source.mSecondarySeq),
00028       mTransactionId(source.mTransactionId)
00029 {}
00030 
00031 DumTimeout::~DumTimeout()
00032 {}
00033 
00034 Message*
00035 DumTimeout::clone() const
00036 {
00037    return new DumTimeout(*this);
00038 }
00039       
00040 DumTimeout::Type 
00041 DumTimeout::type() const
00042 {
00043    return mType;
00044 }
00045 
00046 unsigned int 
00047 DumTimeout::seq() const
00048 {
00049    return mSeq;
00050 }
00051 
00052 unsigned int 
00053 DumTimeout::secondarySeq() const
00054 {
00055    return mSecondarySeq;
00056 }  
00057 
00058 const Data & DumTimeout::transactionId() const
00059 {
00060         return mTransactionId;
00061 }
00062 
00063 bool 
00064 DumTimeout::isClientTransaction() const
00065 {
00066    assert(0);
00067    return false;
00068 }
00069       
00070 EncodeStream&
00071 DumTimeout::encodeBrief(EncodeStream& strm) const
00072 {
00073    return encode(strm);
00074 }
00075 
00076 EncodeStream& 
00077 DumTimeout::encode(EncodeStream& strm) const
00078 {
00079    strm << "DumTimeout::";
00080    switch (mType)
00081    {
00082       case SessionExpiration:
00083          strm <<"SessionExpiration";
00084          break;
00085       case SessionRefresh:
00086          strm <<"SessionRefresh";
00087          break;
00088       case Registration:
00089          strm <<"Registration";
00090          break;
00091       case RegistrationRetry:
00092          strm <<"RegistrationRetry";
00093          break;
00094       case Publication:
00095          strm <<"Publication";
00096          break;
00097       case Retransmit200:
00098          strm <<"Retransmit200";
00099          break;
00100       case Retransmit1xx:
00101          strm <<"Retransmit1xx";
00102          break;
00103       case WaitForAck:
00104          strm <<"WaitForAck";
00105          break;
00106       case CanDiscardAck:
00107          strm <<"CanDiscardAck";
00108          break;
00109       case StaleCall:
00110          strm <<"StaleCall";
00111          break;
00112       case Subscription:
00113          strm <<"Subscription";
00114          break;
00115       case SubscriptionRetry:
00116          strm <<"SubscriptionRetry";
00117          break;
00118       case WaitForNotify:
00119          strm <<"WaitForNotify";
00120          break;
00121       case StaleReInvite:
00122          strm <<"StaleReInvite";
00123          break;
00124       case Glare:
00125          strm <<"Glare";
00126          break;
00127       case Cancelled:
00128          strm <<"Cancelled";
00129          break;
00130       case WaitingForForked2xx:
00131          strm <<"WaitingForForked2xx";
00132          break;
00133       case SendNextNotify:
00134          strm <<"SendNextNotify";
00135          break;
00136    }
00137    // Accessing mUsageHandle is not threadsafe, and this encode method is used outside
00138    // the dum thread, in the stack thread via the TuSelector::add method for logging.
00139    //if (mUsageHandle.isValid()) 
00140    //{
00141    //   strm << " " << *mUsageHandle;
00142    //}
00143    //else 
00144    //{
00145    //   strm << " defunct";
00146    //}
00147    
00148    strm << ": duration=" << mDuration << " seq=" << mSeq;
00149    return strm;
00150 }
00151 
00152 BaseUsageHandle 
00153 DumTimeout::getBaseUsage() const
00154 {
00155    return mUsageHandle;
00156 }
00157 
00158    
00159 /* ====================================================================
00160  * The Vovida Software License, Version 1.0 
00161  * 
00162  * Copyright (c) 2000 Vovida Networks, Inc.  All rights reserved.
00163  * 
00164  * Redistribution and use in source and binary forms, with or without
00165  * modification, are permitted provided that the following conditions
00166  * are met:
00167  * 
00168  * 1. Redistributions of source code must retain the above copyright
00169  *    notice, this list of conditions and the following disclaimer.
00170  * 
00171  * 2. Redistributions in binary form must reproduce the above copyright
00172  *    notice, this list of conditions and the following disclaimer in
00173  *    the documentation and/or other materials provided with the
00174  *    distribution.
00175  * 
00176  * 3. The names "VOCAL", "Vovida Open Communication Application Library",
00177  *    and "Vovida Open Communication Application Library (VOCAL)" must
00178  *    not be used to endorse or promote products derived from this
00179  *    software without prior written permission. For written
00180  *    permission, please contact vocal@vovida.org.
00181  *
00182  * 4. Products derived from this software may not be called "VOCAL", nor
00183  *    may "VOCAL" appear in their name, without prior written
00184  *    permission of Vovida Networks, Inc.
00185  * 
00186  * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
00187  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00188  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
00189  * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL VOVIDA
00190  * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
00191  * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
00192  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00193  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00194  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
00195  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00196  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
00197  * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
00198  * DAMAGE.
00199  * 
00200  * ====================================================================
00201  * 
00202  * This software consists of voluntary contributions made by Vovida
00203  * Networks, Inc. and many individuals on behalf of Vovida Networks,
00204  * Inc.  For more information on Vovida Networks, Inc., please see
00205  * <http://www.vovida.org/>.
00206  *
00207  */