reSIProcate/DialogUsageManager  9680
ClientPagerMessage.hxx
Go to the documentation of this file.
00001 #if !defined(RESIP_CLIENTPAGERMESSAGE_HXX)
00002 #define RESIP_CLIENTPAGERMESSAGE_HXX
00003 
00004 #include "resip/dum/NonDialogUsage.hxx"
00005 #include "resip/stack/CSeqCategory.hxx"
00006 #include "resip/stack/SipMessage.hxx"
00007 #include "resip/dum/DialogUsageManager.hxx"
00008 #include <deque>
00009 #include <memory>
00010 
00011 namespace resip
00012 {
00013 class SipMessage;
00014 
00015 class ClientPagerMessage : public NonDialogUsage
00016 {
00017   public:
00018       ClientPagerMessage(DialogUsageManager& dum, DialogSet& dialogSet);
00019       ClientPagerMessageHandle getHandle();
00020 
00021       //allow the user to adorn the MESSAGE message if desired
00023       //I don't know how this would interact with the queuing mechanism.
00024       //Will come back to re-visit this in the future.
00025       SipMessage& getMessageRequest();
00026 
00028       //queues the message if there is one sent but not yet received a response
00029       //for it.
00030       //asserts if contents->get() is NULL.
00031       virtual void page(std::auto_ptr<Contents> contents, DialogUsageManager::EncryptionLevel level=DialogUsageManager::None);
00032       virtual void end();
00033 
00037       virtual void endCommand();
00038       virtual void pageCommand(std::auto_ptr<Contents> contents, DialogUsageManager::EncryptionLevel level=DialogUsageManager::None);
00039 
00040       virtual void dispatch(const SipMessage& msg);
00041       virtual void dispatch(const DumTimeout& timer);
00042 
00043       size_t       msgQueued () const;
00044 
00045       virtual EncodeStream& dump(EncodeStream& strm) const;
00046 
00047    protected:
00048       virtual ~ClientPagerMessage();
00049 
00050    private:
00051       friend class DialogSet;
00052 
00053       //uses memory from creator
00054       //SipMessage& mRequest;
00055       SharedPtr<SipMessage> mRequest;
00056 
00057       typedef struct
00058       {
00059             DialogUsageManager::EncryptionLevel encryptionLevel;
00060             Contents* contents;
00061       } Item;
00062 
00063       typedef std::deque<Item> MsgQueue;
00064       MsgQueue mMsgQueue;
00065       bool mEnded;
00066 
00067       // disabled
00068       ClientPagerMessage(const ClientPagerMessage&);
00069       ClientPagerMessage& operator=(const ClientPagerMessage&);
00070 
00071       void pageFirstMsgQueued ();
00072       void clearMsgQueued ();
00073 };
00074 
00075 }
00076 
00077 #endif
00078 
00079 /* ====================================================================
00080  * The Vovida Software License, Version 1.0
00081  *
00082  * Copyright (c) 2000 Vovida Networks, Inc.  All rights reserved.
00083  *
00084  * Redistribution and use in source and binary forms, with or without
00085  * modification, are permitted provided that the following conditions
00086  * are met:
00087  *
00088  * 1. Redistributions of source code must retain the above copyright
00089  *    notice, this list of conditions and the following disclaimer.
00090  *
00091  * 2. Redistributions in binary form must reproduce the above copyright
00092  *    notice, this list of conditions and the following disclaimer in
00093  *    the documentation and/or other materials provided with the
00094 
00095  *    distribution.
00096  *
00097  * 3. The names "VOCAL", "Vovida Open Communication Application Library",
00098  *    and "Vovida Open Communication Application Library (VOCAL)" must
00099  *    not be used to endorse or promote products derived from this
00100  *    software without prior written permission. For written
00101  *    permission, please contact vocal@vovida.org.
00102  *
00103  * 4. Products derived from this software may not be called "VOCAL", nor
00104  *    may "VOCAL" appear in their name, without prior written
00105  *    permission of Vovida Networks, Inc.
00106  *
00107  * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
00108  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00109  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
00110  * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL VOVIDA
00111  * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
00112  * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
00113  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00114  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00115  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
00116  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00117  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
00118  * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
00119  * DAMAGE.
00120  *
00121  * ====================================================================
00122  *
00123  * This software consists of voluntary contributions made by Vovida
00124  * Networks, Inc. and many individuals on behalf of Vovida Networks,
00125  * Inc.  For more information on Vovida Networks, Inc., please see
00126  * <http://www.vovida.org/>.
00127  *
00128  */