/[resiprocate]/main/resip/dum/InMemoryRegistrationDatabase.hxx
ViewVC logotype

Contents of /main/resip/dum/InMemoryRegistrationDatabase.hxx

Parent Directory Parent Directory | Revision Log Revision Log


Revision 8754 - (show annotations) (download)
Wed Feb 24 17:56:42 2010 UTC (9 years, 8 months ago) by sgodin
File MIME type: text/plain
File size: 4596 byte(s)
Added ability for repro to synchronize registrations with another instance
-uses two new repro command line options:  xmlrpcport and regsyncpeer
-added a new version of InMemoryRegistrationDatabase called InMemorySyncRegDb. 
 This version has the following new capabilities
 - callback handler so that a reg sync process can get notification of when records change
 - ability to linger removed contacts in memory, so that sync process can accurately reflect
   registration removals on peer system
 - initial sync mechanism for registration sync process
-removed two inefficient (double copy) interfaces on RegistrationPersistanceManager and
 adjusted InMemoryRegistrationDatabase as required
-fixed some registration storage locking bugs in repro
-added new RegSyncClient, RegSyncServer, RegSyncServerThread, XmlRpcConnection and 
 XmlRpcServerBase classes to facilitate transport of registration information in xml 
 format from one node to another 


1 #if !defined(RESIP_INMEMORYREGISTRATIONDATABASE_HXX)
2 #define RESIP_INMEMORYREGISTRATIONDATABASE_HXX
3
4 #include <map>
5 #include <set>
6
7 #include "resip/dum/RegistrationPersistenceManager.hxx"
8 #include "rutil/Mutex.hxx"
9 #include "rutil/Condition.hxx"
10 #include "rutil/Lock.hxx"
11
12 namespace resip
13 {
14
15 /**
16 Trivial implementation of a persistence manager. This class keeps
17 all registrations in memory, and has no schemes for disk storage
18 or replication of any kind. It's good for testing, but probably
19 inappropriate for any commercially deployable products.
20 */
21 class InMemoryRegistrationDatabase : public RegistrationPersistenceManager
22 {
23 public:
24
25 /**
26 * @param checkExpiry if set, then the methods aorIsRegistered() and
27 * getContacts() will check that contacts are
28 * not expired before returning an answer.
29 */
30 InMemoryRegistrationDatabase(bool checkExpiry = false);
31 virtual ~InMemoryRegistrationDatabase();
32
33 virtual void addAor(const Uri& aor, const ContactList& contacts);
34 virtual void removeAor(const Uri& aor);
35 virtual bool aorIsRegistered(const Uri& aor);
36
37 virtual void lockRecord(const Uri& aor);
38 virtual void unlockRecord(const Uri& aor);
39
40 virtual update_status_t updateContact(const resip::Uri& aor,
41 const ContactInstanceRecord& rec);
42 virtual void removeContact(const Uri& aor,
43 const ContactInstanceRecord& rec);
44
45 virtual void getContacts(const Uri& aor, ContactList& container);
46
47 /// return all the AOR in the DB
48 virtual void getAors(UriList& container);
49
50 private:
51 typedef std::map<Uri,ContactList *> database_map_t;
52 database_map_t mDatabase;
53 Mutex mDatabaseMutex;
54
55 std::set<Uri> mLockedRecords;
56 Mutex mLockedRecordsMutex;
57 Condition mRecordUnlocked;
58
59 bool mCheckExpiry;
60
61 protected:
62 /**
63 * Find aor in mDatabase
64 * Before returning the iterator pointing to aor,
65 * delete all expired contacts
66 */
67 database_map_t::iterator findNotExpired(const Uri& aor);
68
69 };
70
71 }
72
73 #endif
74
75 /* ====================================================================
76 * The Vovida Software License, Version 1.0
77 *
78 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
79 *
80 * Redistribution and use in source and binary forms, with or without
81 * modification, are permitted provided that the following conditions
82 * are met:
83 *
84 * 1. Redistributions of source code must retain the above copyright
85 * notice, this list of conditions and the following disclaimer.
86 *
87 * 2. Redistributions in binary form must reproduce the above copyright
88 * notice, this list of conditions and the following disclaimer in
89 * the documentation and/or other materials provided with the
90 * distribution.
91 *
92 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
93 * and "Vovida Open Communication Application Library (VOCAL)" must
94 * not be used to endorse or promote products derived from this
95 * software without prior written permission. For written
96 * permission, please contact vocal@vovida.org.
97 *
98 * 4. Products derived from this software may not be called "VOCAL", nor
99 * may "VOCAL" appear in their name, without prior written
100 * permission of Vovida Networks, Inc.
101 *
102 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
103 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
104 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
105 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
106 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
107 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
108 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
109 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
110 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
111 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
112 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
113 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
114 * DAMAGE.
115 *
116 * ====================================================================
117 *
118 * This software consists of voluntary contributions made by Vovida
119 * Networks, Inc. and many individuals on behalf of Vovida Networks,
120 * Inc. For more information on Vovida Networks, Inc., please see
121 * <http://www.vovida.org/>.
122 *
123 */

Properties

Name Value
svn:eol-style native
svn:mime-type text/plain

webmaster AT resiprocate DOT org
ViewVC Help
Powered by ViewVC 1.1.27