reSIProcate/DialogUsageManager  9694
ServerInviteSession.hxx
Go to the documentation of this file.
00001 #if !defined(RESIP_SERVERINVITESESSION_HXX)
00002 #define RESIP_SERVERINVITESESSION_HXX
00003 
00004 #include "resip/dum/InviteSession.hxx"
00005 #include "resip/stack/SipMessage.hxx"
00006 
00007 #include <deque>
00008 
00009 namespace resip
00010 {
00011 
00012 class ServerInviteSession: public InviteSession
00013 {
00014    public:
00015       typedef Handle<ServerInviteSession> ServerInviteSessionHandle;
00016       ServerInviteSessionHandle getHandle();
00017 
00019       void redirect(const NameAddrs& contacts, int code=302);
00020 
00024       void provisional(int code=180, bool earlyFlag=true);
00025       
00030       virtual void provideOffer(const Contents& offer);
00031       virtual void provideOffer(const Contents& offer, DialogUsageManager::EncryptionLevel level, const Contents* alternative);
00032 
00035       virtual void requestOffer();
00036 
00040       virtual void provideAnswer(const Contents& answer);
00041 
00043       virtual void end(const Data& userReason);
00044       virtual void end(EndReason reason);
00045       virtual void end();
00046 
00049       virtual void reject(int statusCode, WarningCategory *warning = 0);
00050 
00052       void accept(int statusCode=200);
00053 
00057       void redirectCommand(const NameAddrs& contacts, int code=302);
00058       void provisionalCommand(int code=180);
00059       void acceptCommand(int statusCode=200);
00060 
00061    private:
00062       friend class Dialog;
00063 
00064       virtual void dispatch(const SipMessage& msg);
00065       virtual void dispatch(const DumTimeout& timer);
00066 
00067       void dispatchStart(const SipMessage& msg);
00068       void dispatchOfferOrEarly(const SipMessage& msg);
00069       void dispatchAccepted(const SipMessage& msg);
00070       void dispatchWaitingToOffer(const SipMessage& msg);
00071       void dispatchWaitingToRequestOffer(const SipMessage& msg);
00072       void dispatchAcceptedWaitingAnswer(const SipMessage& msg);
00073       void dispatchOfferReliable(const SipMessage& msg);
00074       void dispatchNoOfferReliable(const SipMessage& msg);
00075       void dispatchFirstSentOfferReliable(const SipMessage& msg);
00076       void dispatchFirstEarlyReliable(const SipMessage& msg);
00077       void dispatchEarlyReliable(const SipMessage& msg);
00078       void dispatchSentUpdate(const SipMessage& msg);
00079       void dispatchSentUpdateAccepted(const SipMessage& msg);
00080       void dispatchReceivedUpdate(const SipMessage& msg);
00081       void dispatchReceivedUpdateWaitingAnswer(const SipMessage& msg);
00082       void dispatchWaitingToTerminate(const SipMessage& msg);
00083       void dispatchWaitingToHangup(const SipMessage& msg);
00084 
00085       void dispatchCancel(const SipMessage& msg);
00086       void dispatchBye(const SipMessage& msg);
00087       void dispatchUnknown(const SipMessage& msg);
00088 
00089       // utilities
00090       void startRetransmit1xxTimer();
00091       void sendAccept(int code, Contents* offerAnswer); // sends 2xxI
00092       void sendProvisional(int code, bool earlyFlag);
00093       void sendUpdate(const Contents& offerAnswer);
00094 
00095       ServerInviteSession(DialogUsageManager& dum, Dialog& dialog, const SipMessage& msg);
00096 
00097       // disabled
00098       ServerInviteSession(const ServerInviteSession&);
00099       ServerInviteSession& operator=(const ServerInviteSession&);
00100 
00101       // stores the original request
00102       const SipMessage mFirstRequest;
00103       SharedPtr<SipMessage> m1xx; // for 1xx retransmissions
00104       unsigned long mCurrentRetransmit1xx;
00105       
00106       //std::deque<SipMessage> mUnacknowledgedProvisionals; // all of them
00107       //SipMessage m200; // for retransmission
00108 };
00109 
00110 }
00111 
00112 #endif
00113 
00114 /* ====================================================================
00115  * The Vovida Software License, Version 1.0 
00116  * 
00117  * Copyright (c) 2000 Vovida Networks, Inc.  All rights reserved.
00118  * 
00119  * Redistribution and use in source and binary forms, with or without
00120  * modification, are permitted provided that the following conditions
00121  * are met:
00122  * 
00123  * 1. Redistributions of source code must retain the above copyright
00124  *    notice, this list of conditions and the following disclaimer.
00125  * 
00126  * 2. Redistributions in binary form must reproduce the above copyright
00127  *    notice, this list of conditions and the following disclaimer in
00128  *    the documentation and/or other materials provided with the
00129 
00130  *    distribution.
00131  * 
00132  * 3. The names "VOCAL", "Vovida Open Communication Application Library",
00133  *    and "Vovida Open Communication Application Library (VOCAL)" must
00134  *    not be used to endorse or promote products derived from this
00135  *    software without prior written permission. For written
00136  *    permission, please contact vocal@vovida.org.
00137  *
00138  * 4. Products derived from this software may not be called "VOCAL", nor
00139  *    may "VOCAL" appear in their name, without prior written
00140  *    permission of Vovida Networks, Inc.
00141  * 
00142  * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
00143  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00144  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
00145  * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL VOVIDA
00146  * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
00147  * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
00148  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00149  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00150  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
00151  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00152  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
00153  * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
00154  * DAMAGE.
00155  * 
00156  * ====================================================================
00157  * 
00158  * This software consists of voluntary contributions made by Vovida
00159  * Networks, Inc. and many individuals on behalf of Vovida Networks,
00160  * Inc.  For more information on Vovida Networks, Inc., please see
00161  * <http://www.vovida.org/>.
00162  *
00163  */