reSIProcate/DialogUsageManager  9694
InMemoryRegistrationDatabase.hxx
Go to the documentation of this file.
00001 #if !defined(RESIP_INMEMORYREGISTRATIONDATABASE_HXX)
00002 #define RESIP_INMEMORYREGISTRATIONDATABASE_HXX
00003 
00004 #include <map>
00005 #include <set>
00006 
00007 #include "resip/dum/RegistrationPersistenceManager.hxx"
00008 #include "rutil/Mutex.hxx"
00009 #include "rutil/Condition.hxx"
00010 #include "rutil/Lock.hxx"
00011 
00012 namespace resip
00013 {
00014 
00021 class InMemoryRegistrationDatabase : public RegistrationPersistenceManager
00022 {
00023    public:
00024 
00030       InMemoryRegistrationDatabase(bool checkExpiry = false);
00031       virtual ~InMemoryRegistrationDatabase();
00032       
00033       virtual void addAor(const Uri& aor, const ContactList& contacts);
00034       virtual void removeAor(const Uri& aor);
00035       virtual bool aorIsRegistered(const Uri& aor);
00036       
00037       virtual void lockRecord(const Uri& aor);
00038       virtual void unlockRecord(const Uri& aor);
00039       
00040       virtual update_status_t updateContact(const resip::Uri& aor,
00041                                              const ContactInstanceRecord& rec);
00042       virtual void removeContact(const Uri& aor, 
00043                                  const ContactInstanceRecord& rec);
00044       
00045       virtual void getContacts(const Uri& aor, ContactList& container);
00046    
00048       virtual void getAors(UriList& container);
00049       
00050    private:
00051       typedef std::map<Uri,ContactList *> database_map_t;
00052       database_map_t mDatabase;
00053       Mutex mDatabaseMutex;
00054       
00055       std::set<Uri> mLockedRecords;
00056       Mutex mLockedRecordsMutex;
00057       Condition mRecordUnlocked;
00058 
00059       bool mCheckExpiry;
00060 
00061    protected:
00067       database_map_t::iterator findNotExpired(const Uri& aor);
00068 
00069 };
00070 
00071 }
00072 
00073 #endif
00074 
00075 /* ====================================================================
00076  * The Vovida Software License, Version 1.0 
00077  * 
00078  * Copyright (c) 2000 Vovida Networks, Inc.  All rights reserved.
00079  * 
00080  * Redistribution and use in source and binary forms, with or without
00081  * modification, are permitted provided that the following conditions
00082  * are met:
00083  * 
00084  * 1. Redistributions of source code must retain the above copyright
00085  *    notice, this list of conditions and the following disclaimer.
00086  * 
00087  * 2. Redistributions in binary form must reproduce the above copyright
00088  *    notice, this list of conditions and the following disclaimer in
00089  *    the documentation and/or other materials provided with the
00090  *    distribution.
00091  * 
00092  * 3. The names "VOCAL", "Vovida Open Communication Application Library",
00093  *    and "Vovida Open Communication Application Library (VOCAL)" must
00094  *    not be used to endorse or promote products derived from this
00095  *    software without prior written permission. For written
00096  *    permission, please contact vocal@vovida.org.
00097  *
00098  * 4. Products derived from this software may not be called "VOCAL", nor
00099  *    may "VOCAL" appear in their name, without prior written
00100  *    permission of Vovida Networks, Inc.
00101  * 
00102  * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
00103  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00104  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
00105  * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL VOVIDA
00106  * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
00107  * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
00108  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00109  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00110  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
00111  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00112  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
00113  * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
00114  * DAMAGE.
00115  * 
00116  * ====================================================================
00117  * 
00118  * This software consists of voluntary contributions made by Vovida
00119  * Networks, Inc. and many individuals on behalf of Vovida Networks,
00120  * Inc.  For more information on Vovida Networks, Inc., please see
00121  * <http://www.vovida.org/>.
00122  *
00123  */