reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
InMemorySyncRegDb.hxx
Go to the documentation of this file.
1#if !defined(RESIP_INMEMORYSYNCREGDB_HXX)
2#define RESIP_INMEMORYSYNCREGDB_HXX
3
4#include <map>
5#include <set>
6#include <list>
7
9#include "rutil/Mutex.hxx"
10#include "rutil/Condition.hxx"
11#include "rutil/Lock.hxx"
12
13namespace resip
14{
15
17{
18public:
19 typedef enum
20 {
27 virtual void onAorModified(const resip::Uri& aor, const ContactList& contacts) = 0;
28 virtual void onInitialSyncAor(unsigned int connectionId, const resip::Uri& aor, const ContactList& contacts) {}
29protected:
31};
32
33
53{
54 public:
55
56 InMemorySyncRegDb(unsigned int removeLingerSecs = 0);
57 virtual ~InMemorySyncRegDb();
58
59 virtual void addHandler(InMemorySyncRegDbHandler* handler);
60 virtual void removeHandler(InMemorySyncRegDbHandler* handler);
61
62 virtual void initialSync(unsigned int connectionId);
63
64 virtual void addAor(const Uri& aor, const ContactList& contacts);
65 virtual void removeAor(const Uri& aor);
66 virtual bool aorIsRegistered(const Uri& aor);
67 virtual bool aorIsRegistered(const Uri& aor, uint64_t* maxExpires);
68
69 virtual void lockRecord(const Uri& aor);
70 virtual void unlockRecord(const Uri& aor);
71
72 virtual update_status_t updateContact(const resip::Uri& aor,
73 const ContactInstanceRecord& rec);
74 virtual void removeContact(const Uri& aor,
75 const ContactInstanceRecord& rec);
76
77 virtual void getContacts(const Uri& aor, ContactList& container);
78 virtual void getContactsFull(const Uri& aor, ContactList& container);
79
81 virtual void getAors(UriList& container);
82
83 protected:
84 typedef std::map<Uri,ContactList *> database_map_t;
87
88 std::set<Uri> mLockedRecords;
91
92 void invokeOnAorModified(bool sync, const resip::Uri& aor, const ContactList& contacts);
93 void invokeOnInitialSyncAor(unsigned int connectionId, const resip::Uri& aor, const ContactList& contacts);
94 unsigned int mRemoveLingerSecs;
95 typedef std::list<InMemorySyncRegDbHandler*> HandlerList;
96 HandlerList mHandlers; // use list over set to preserve add order
98};
99
100}
101
102#endif
103
104/* ====================================================================
105 * The Vovida Software License, Version 1.0
106 *
107 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
108 *
109 * Redistribution and use in source and binary forms, with or without
110 * modification, are permitted provided that the following conditions
111 * are met:
112 *
113 * 1. Redistributions of source code must retain the above copyright
114 * notice, this list of conditions and the following disclaimer.
115 *
116 * 2. Redistributions in binary form must reproduce the above copyright
117 * notice, this list of conditions and the following disclaimer in
118 * the documentation and/or other materials provided with the
119 * distribution.
120 *
121 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
122 * and "Vovida Open Communication Application Library (VOCAL)" must
123 * not be used to endorse or promote products derived from this
124 * software without prior written permission. For written
125 * permission, please contact vocal@vovida.org.
126 *
127 * 4. Products derived from this software may not be called "VOCAL", nor
128 * may "VOCAL" appear in their name, without prior written
129 * permission of Vovida Networks, Inc.
130 *
131 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
132 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
133 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
134 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
135 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
136 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
137 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
138 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
139 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
140 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
141 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
142 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
143 * DAMAGE.
144 *
145 * ====================================================================
146 *
147 * This software consists of voluntary contributions made by Vovida
148 * Networks, Inc. and many individuals on behalf of Vovida Networks,
149 * Inc. For more information on Vovida Networks, Inc., please see
150 * <http://www.vovida.org/>.
151 *
152 */
A single contact record, bound to an Aor during registration.
InMemorySyncRegDbHandler(HandlerMode mode=SyncServer)
virtual void onInitialSyncAor(unsigned int connectionId, const resip::Uri &aor, const ContactList &contacts)
virtual void onAorModified(const resip::Uri &aor, const ContactList &contacts)=0
Implementation of a persistence manager.
virtual void removeContact(const Uri &aor, const ContactInstanceRecord &rec)
virtual void removeAor(const Uri &aor)
virtual update_status_t updateContact(const resip::Uri &aor, const ContactInstanceRecord &rec)
virtual void addHandler(InMemorySyncRegDbHandler *handler)
virtual void unlockRecord(const Uri &aor)
std::map< Uri, ContactList * > database_map_t
virtual bool aorIsRegistered(const Uri &aor)
virtual void getContactsFull(const Uri &aor, ContactList &container)
void invokeOnInitialSyncAor(unsigned int connectionId, const resip::Uri &aor, const ContactList &contacts)
virtual void initialSync(unsigned int connectionId)
virtual void addAor(const Uri &aor, const ContactList &contacts)
virtual void getAors(UriList &container)
return all the AOR in the DB
virtual void getContacts(const Uri &aor, ContactList &container)
std::list< InMemorySyncRegDbHandler * > HandlerList
virtual void lockRecord(const Uri &aor)
void invokeOnAorModified(bool sync, const resip::Uri &aor, const ContactList &contacts)
virtual void removeHandler(InMemorySyncRegDbHandler *handler)
Abstract interface of a datastore of all registered endpoints processed by DUM.
Represents the "SIP-URI" and "SIPS-URI" elements in the RFC 3261 grammar.
Definition Uri.hxx:22
dcm! – add UnusedChecking(_enum) below;
std::mutex Mutex
A semaphore that can be locked by only one thread at a time.
Definition Mutex.hxx:37
unsigned long long uint64_t
Definition Stun.hxx:39
std::condition_variable Condition
A condition variable that can be signaled or waited on, wraps POSIX/Windows implementations depending...
Definition Condition.hxx:51
std::list< ContactInstanceRecord > ContactList