reSIProcate/DialogUsageManager  9680
DialogEventInfo.hxx
Go to the documentation of this file.
00001 #if !defined(RESIP_DialogEventInfo_hxx)
00002 #define RESIP_DialogEventInfo_hxx
00003 
00004 #include <memory>
00005 #include "resip/stack/NameAddr.hxx"
00006 #include "resip/dum/DialogId.hxx"
00007 #include "resip/dum/Handles.hxx"
00008 #include "resip/stack/Contents.hxx"
00009 
00010 namespace resip
00011 {
00012 
00013 //As uac, one is created for DialogSet; given to first dialog, new instances are
00014 //generated for each fork.  As uas, created at the same time as a Dialog.
00015 class DialogEventInfo
00016 {
00017    public:
00018       DialogEventInfo(void);
00019       DialogEventInfo(const DialogEventInfo& rhs);
00020       DialogEventInfo& operator=(const DialogEventInfo& dialogEventInfo);
00021       
00022       //based on DialogEventId
00023       bool operator==(const DialogEventInfo& rhs) const;
00024       bool operator!=(const DialogEventInfo& rhs) const;
00025       bool operator<(const DialogEventInfo& rhs) const;
00026          
00027       enum Direction 
00028       {
00029          Initiator,
00030          Recipient
00031       };
00032 
00033       enum State
00034       {
00035          Trying = 0,
00036          Proceeding,
00037          Early,
00038          Confirmed,
00039          Terminated
00040       };
00041 
00042       const State& getState() const;
00043 
00044       const Data& getDialogEventId() const;
00045       
00046       const Data& getCallId() const;
00047       const Data& getLocalTag() const;
00048       bool hasRemoteTag() const;
00049       const Data& getRemoteTag() const;
00050       
00051       bool hasRefferedBy() const;
00052       const NameAddr& getRefferredBy() const;
00053       
00054       const NameAddr& getLocalIdentity() const;
00055       const NameAddr& getRemoteIdentity() const;
00056       const Uri& getLocalTarget() const;
00057       //has... below only applicable when direction is outgoing
00058       bool hasRouteSet() const;
00059       const NameAddrs& getRouteSet() const;
00060       bool hasRemoteTarget() const;
00061       const Uri& getRemoteTarget() const;
00062 
00063       // cache the first one, then forevermore lookup from InviteSession
00064       const Contents& getLocalOfferAnswer() const;
00065       const Contents& getRemoteOfferAnswer() const;
00066       bool hasLocalOfferAnswer() const;
00067       bool hasRemoteOfferAnswer() const;
00068 
00069       UInt64 getDurationSeconds() const; // in seconds
00070 
00071       bool hasReplacesId() const;
00072       const DialogId& getReplacesId() const;
00073 
00074       Direction getDirection() const;
00075 
00076    protected:
00077       friend class DialogEventStateManager;
00078 
00079       State mState;
00080       Data mDialogEventId; //unique for all Dialogs at this ua...may hash local +
00081                           //callid, all 3 tags for forks.  Or could cycles an
00082                           //integer...hash memory location+salt at cons time(might be easiest).
00083       DialogId mDialogId;
00084       Direction mDirection;
00085       //ID of the dialog this dialog replaced.
00086       std::auto_ptr<DialogId> mReplacesId;
00087       InviteSessionHandle mInviteSession;
00088 
00089       std::auto_ptr<NameAddr> mReferredBy;
00090 
00091 //could back-point to dialog for this information to save space
00092       NameAddrs mRouteSet; 
00093       NameAddr mLocalIdentity;
00094       NameAddr mRemoteIdentity;
00095       Uri mLocalTarget;
00096       std::auto_ptr<Uri> mRemoteTarget;
00097 
00098       UInt64 mCreationTimeSeconds;
00099 
00100       std::auto_ptr<Contents> mLocalOfferAnswer;
00101       std::auto_ptr<Contents> mRemoteOfferAnswer;
00102 
00103    private:
00104       bool mReplaced;
00105 };
00106 
00107 }
00108 
00109 #endif
00110 
00111 
00112 /* ====================================================================
00113  * The Vovida Software License, Version 1.0 
00114  * 
00115  * Copyright (c) 2000 Vovida Networks, Inc.  All rights reserved.
00116  * 
00117  * Redistribution and use in source and binary forms, with or without
00118  * modification, are permitted provided that the following conditions
00119  * are met:
00120  * 
00121  * 1. Redistributions of source code must retain the above copyright
00122  *    notice, this list of conditions and the following disclaimer.
00123  * 
00124  * 2. Redistributions in binary form must reproduce the above copyright
00125  *    notice, this list of conditions and the following disclaimer in
00126  *    the documentation and/or other materials provided with the
00127  *    distribution.
00128  * 
00129  * 3. The names "VOCAL", "Vovida Open Communication Application Library",
00130  *    and "Vovida Open Communication Application Library (VOCAL)" must
00131  *    not be used to endorse or promote products derived from this
00132  *    software without prior written permission. For written
00133  *    permission, please contact vocal@vovida.org.
00134  *
00135  * 4. Products derived from this software may not be called "VOCAL", nor
00136  *    may "VOCAL" appear in their name, without prior written
00137  *    permission of Vovida Networks, Inc.
00138  * 
00139  * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
00140  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00141  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
00142  * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL VOVIDA
00143  * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
00144  * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
00145  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00146  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00147  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
00148  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00149  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
00150  * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
00151  * DAMAGE.
00152  * 
00153  * ====================================================================
00154  * 
00155  * This software consists of voluntary contributions made by Vovida
00156  * Networks, Inc. and many individuals on behalf of Vovida Networks,
00157  * Inc.  For more information on Vovida Networks, Inc., please see
00158  * <http://www.vovida.org/>.
00159  *
00160  */