|
reSIProcate/DialogUsageManager
9694
|
00001 #if !defined(RESIP_INMEMORYSYNCREGDB_HXX) 00002 #define RESIP_INMEMORYSYNCREGDB_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 00015 class InMemorySyncRegDbHandler 00016 { 00017 public: 00018 virtual ~InMemorySyncRegDbHandler(){} 00019 virtual void onAorModified(const resip::Uri& aor, const ContactList& contacts) = 0; 00020 virtual void onInitialSyncAor(unsigned int connectionId, const resip::Uri& aor, const ContactList& contacts) = 0; 00021 }; 00022 00041 class InMemorySyncRegDb : public RegistrationPersistenceManager 00042 { 00043 public: 00044 00045 InMemorySyncRegDb(unsigned int removeLingerSecs = 0); 00046 virtual ~InMemorySyncRegDb(); 00047 00048 virtual void setHandler(InMemorySyncRegDbHandler* handler) { mHandler = handler; } 00049 virtual void initialSync(unsigned int connectionId); 00050 00051 virtual void addAor(const Uri& aor, const ContactList& contacts); 00052 virtual void removeAor(const Uri& aor); 00053 virtual bool aorIsRegistered(const Uri& aor); 00054 00055 virtual void lockRecord(const Uri& aor); 00056 virtual void unlockRecord(const Uri& aor); 00057 00058 virtual update_status_t updateContact(const resip::Uri& aor, 00059 const ContactInstanceRecord& rec); 00060 virtual void removeContact(const Uri& aor, 00061 const ContactInstanceRecord& rec); 00062 00063 virtual void getContacts(const Uri& aor, ContactList& container); 00064 virtual void getContactsFull(const Uri& aor, ContactList& container); 00065 00067 virtual void getAors(UriList& container); 00068 00069 private: 00070 typedef std::map<Uri,ContactList *> database_map_t; 00071 database_map_t mDatabase; 00072 Mutex mDatabaseMutex; 00073 00074 std::set<Uri> mLockedRecords; 00075 Mutex mLockedRecordsMutex; 00076 Condition mRecordUnlocked; 00077 00078 unsigned int mRemoveLingerSecs; 00079 InMemorySyncRegDbHandler* mHandler; 00080 }; 00081 00082 } 00083 00084 #endif 00085 00086 /* ==================================================================== 00087 * The Vovida Software License, Version 1.0 00088 * 00089 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved. 00090 * 00091 * Redistribution and use in source and binary forms, with or without 00092 * modification, are permitted provided that the following conditions 00093 * are met: 00094 * 00095 * 1. Redistributions of source code must retain the above copyright 00096 * notice, this list of conditions and the following disclaimer. 00097 * 00098 * 2. Redistributions in binary form must reproduce the above copyright 00099 * notice, this list of conditions and the following disclaimer in 00100 * the documentation and/or other materials provided with the 00101 * distribution. 00102 * 00103 * 3. The names "VOCAL", "Vovida Open Communication Application Library", 00104 * and "Vovida Open Communication Application Library (VOCAL)" must 00105 * not be used to endorse or promote products derived from this 00106 * software without prior written permission. For written 00107 * permission, please contact vocal@vovida.org. 00108 * 00109 * 4. Products derived from this software may not be called "VOCAL", nor 00110 * may "VOCAL" appear in their name, without prior written 00111 * permission of Vovida Networks, Inc. 00112 * 00113 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED 00114 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 00115 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND 00116 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA 00117 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES 00118 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL, 00119 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00120 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00121 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 00122 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00123 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 00124 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 00125 * DAMAGE. 00126 * 00127 * ==================================================================== 00128 * 00129 * This software consists of voluntary contributions made by Vovida 00130 * Networks, Inc. and many individuals on behalf of Vovida Networks, 00131 * Inc. For more information on Vovida Networks, Inc., please see 00132 * <http://www.vovida.org/>. 00133 * 00134 */
1.7.5.1