reSIProcate/repro  9694
Registrar.hxx
Go to the documentation of this file.
00001 #if !defined(RESIP_REGISTRAR_HXX)
00002 #define RESIP_REGISTRAR_HXX 
00003 
00004 #include "resip/dum/RegistrationHandler.hxx"
00005 #include "resip/dum/DialogUsageManager.hxx"
00006 #include "resip/dum/InMemoryRegistrationDatabase.hxx"
00007 #include "resip/dum/MasterProfile.hxx"
00008 
00009 namespace repro
00010 {
00011 
00012 class RegistrarHandler
00013 {
00014    public:
00015       virtual ~RegistrarHandler() {}
00016 
00017       /// Note: These very closely mimic the ServerRegistrationHandler callbacks
00018 
00019       /// For all of the below callbacks - return true if no response was generated and processing
00020       /// should continue.  If all handlers return true, then the Registrar will accept the request.
00021 
00022       /// Called when registration is refreshed
00023       virtual bool onRefresh(resip::ServerRegistrationHandle, const resip::SipMessage& reg)=0;
00024       
00025       /// called when one or more specified contacts is removed
00026       virtual bool onRemove(resip::ServerRegistrationHandle, const resip::SipMessage& reg)=0;
00027       
00028       /// Called when all the contacts are removed using "Contact: *"
00029       virtual bool onRemoveAll(resip::ServerRegistrationHandle, const resip::SipMessage& reg)=0;
00030       
00031       /** Called when one or more contacts are added. This is after 
00032           authentication has all succeeded */
00033       virtual bool onAdd(resip::ServerRegistrationHandle, const resip::SipMessage& reg)=0;
00034 
00035       /// Called when a client queries for the list of current registrations
00036       virtual bool onQuery(resip::ServerRegistrationHandle, const resip::SipMessage& reg)=0;
00037 };
00038 
00039 class Registrar: public resip::ServerRegistrationHandler
00040 {
00041    public:
00042       Registrar();
00043       virtual ~Registrar();
00044       
00045       virtual void addRegistrarHandler(RegistrarHandler* handler);
00046 
00047       virtual void onRefresh(resip::ServerRegistrationHandle, const resip::SipMessage& reg);
00048       virtual void onRemove(resip::ServerRegistrationHandle, const resip::SipMessage& reg);
00049       virtual void onRemoveAll(resip::ServerRegistrationHandle, const resip::SipMessage& reg);
00050       virtual void onAdd(resip::ServerRegistrationHandle, const resip::SipMessage& reg);
00051       virtual void onQuery(resip::ServerRegistrationHandle, const resip::SipMessage& reg);
00052 
00053    private:
00054       std::list<RegistrarHandler*> mRegistrarHandlers;
00055 };
00056 }
00057 #endif
00058 
00059 /* ====================================================================
00060  * The Vovida Software License, Version 1.0 
00061  * 
00062  * Copyright (c) 2000 Vovida Networks, Inc.  All rights reserved.
00063  * 
00064  * Redistribution and use in source and binary forms, with or without
00065  * modification, are permitted provided that the following conditions
00066  * are met:
00067  * 
00068  * 1. Redistributions of source code must retain the above copyright
00069  *    notice, this list of conditions and the following disclaimer.
00070  * 
00071  * 2. Redistributions in binary form must reproduce the above copyright
00072  *    notice, this list of conditions and the following disclaimer in
00073  *    the documentation and/or other materials provided with the
00074  *    distribution.
00075  * 
00076  * 3. The names "VOCAL", "Vovida Open Communication Application Library",
00077  *    and "Vovida Open Communication Application Library (VOCAL)" must
00078  *    not be used to endorse or promote products derived from this
00079  *    software without prior written permission. For written
00080  *    permission, please contact vocal@vovida.org.
00081  *
00082  * 4. Products derived from this software may not be called "VOCAL", nor
00083  *    may "VOCAL" appear in their name, without prior written
00084  *    permission of Vovida Networks, Inc.
00085  * 
00086  * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
00087  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00088  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
00089  * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL VOVIDA
00090  * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
00091  * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
00092  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00093  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00094  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
00095  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00096  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
00097  * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
00098  * DAMAGE.
00099  * 
00100  * ====================================================================
00101  * 
00102  * This software consists of voluntary contributions made by Vovida
00103  * Networks, Inc. and many individuals on behalf of Vovida Networks,
00104  * Inc.  For more information on Vovida Networks, Inc., please see
00105  * <http://www.vovida.org/>.
00106  *
00107  */