1#if defined(HAVE_CONFIG_H)
26#define RESIPROCATE_SUBSYSTEM Subsystem::REPRO
47#ifdef BUILD_QPID_PROTON
51 XmlRpcHandler(std::unique_ptr<XmlRpcProtonServer>(new XmlRpcProtonServer(*this, brokerQueue, true))),
80 unsigned int requestId,
81 const Data& responseData,
82 unsigned int resultCode,
83 const Data& resultText)
86 ss <<
Symbols::CRLF << responseData <<
" <Result Code=\"" << resultCode <<
"\"";
88 mRpc->sendResponse(connectionId, requestId, ss.str().c_str(), resultCode >= 200 );
103 std::stringstream ss;
104 bool infoFound =
false;
108 ContactList::const_iterator cit = contacts.
begin();
109 for(; cit != contacts.end(); cit++)
115 streamContactInstanceRecord(ss, rec);
123 mRpc->sendEvent(connectionId, ss.str().c_str());
130 std::stringstream ss;
134 ss <<
" <eventtype>" << eventType <<
"</eventtype>" <<
Symbols::CRLF;
137 ss <<
" <expires>" << (expirationTime <= now ? 0 : expirationTime - now) <<
"</expires>" <<
Symbols::CRLF;
138 ss <<
" <lastupdate>" << now - lastUpdated <<
"</lastupdate>" <<
Symbols::CRLF;
139 if (expirationTime != 0 && contents != 0)
143 ss <<
" <isencrypted>" << (securityAttributes->
isEncrypted() ?
"true" :
"false") <<
"</isencrypted>" <<
Symbols::CRLF;
146 ss <<
" <sigstatus>";
180 ss <<
" <identitystrength>";
187 ss <<
"failedidentity";
204 mRpc->sendEvent(connectionId, ss.str().c_str());
210 std::stringstream ss;
218 ss <<
" <lastupdate>" << now - lastUpdated <<
"</lastupdate>" <<
Symbols::CRLF;
221 mRpc->sendEvent(connectionId, ss.str().c_str());
227 DebugLog (<<
"RegSyncServer::handleRequest: connectionId=" << connectionId <<
", requestId=" << requestId <<
", request=" << request);
236 handleInitialSyncRequest(connectionId, requestId, xml);
240 WarningLog(<<
"RegSyncServer::handleRequest: Received XML message with unknown method: " << xml.
getTag());
246 WarningLog(<<
"RegSyncServer::handleRequest: ParseException: " << e);
252RegSyncServer::handleInitialSyncRequest(
unsigned int connectionId,
unsigned int requestId,
XMLCursor& xml)
254 InfoLog(<<
"RegSyncServer::handleInitialSyncRequest");
257 unsigned int version = 0;
367 sendDocumentModifiedEvent(connectionId, eventType, documentKey, eTag, expirationTime, lastUpdated, contents, securityAttributes);
#define WarningLog(args_)
#define resip_assert(x)
This file needs to work for both C and C++ code.
Handles cross-platform sockets compatibility.
virtual void onInitialSyncDocument(unsigned int connectionId, const resip::Data &eventType, const resip::Data &documentKey, const resip::Data &eTag, uint64_t expirationTime, uint64_t lastUpdated, const resip::Contents *contents, const resip::SecurityAttributes *securityAttributes)
virtual void sendDocumentModifiedEvent(unsigned int connectionId, const resip::Data &eventType, const resip::Data &documentKey, const resip::Data &eTag, uint64_t expirationTime, uint64_t lastUpdated, const resip::Contents *contents, const resip::SecurityAttributes *securityAttributes)
virtual void onInitialSyncAor(unsigned int connectionId, const resip::Uri &aor, const resip::ContactList &contacts)
virtual void sendRegistrationModifiedEvent(unsigned int connectionId, const resip::Uri &aor)
virtual void handleRequest(unsigned int connectionId, unsigned int requestId, const resip::Data &request)
virtual void sendResponse(unsigned int connectionId, unsigned int requestId, const resip::Data &responseData, unsigned int resultCode, const resip::Data &resultText)
virtual void onDocumentModified(bool sync, const resip::Data &eventType, const resip::Data &documentKey, const resip::Data &eTag, uint64_t expirationTime, uint64_t lastUpdated, const resip::Contents *contents, const resip::SecurityAttributes *securityAttributes)
virtual void onDocumentRemoved(bool sync, const resip::Data &eventType, const resip::Data &documentKey, const resip::Data &eTag, uint64_t lastUpdated)
virtual void sendDocumentRemovedEvent(unsigned int connectionId, const resip::Data &eventType, const resip::Data &documentKey, const resip::Data &eTag, uint64_t lastUpdated)
RegSyncServer(resip::InMemorySyncRegDb *regDb, int port, resip::IpVersion version, resip::InMemorySyncPubDb *pubDb=0)
virtual void onAorModified(const resip::Uri &aor, const resip::ContactList &contacts)
std::shared_ptr< XmlRpcServerBase > mRpc
The abstract base-class for all exceptions thrown by resip code.
Base class for all SIP body types.
virtual Data getBodyData() const
An alternative to std::string, encapsulates an arbitrary buffer of bytes.
static const Data Empty
Constant that represents a zero-length data.
Data base64encode(bool useUrlSafe=false) const
Performs RFC 3548 Base 64 encoding of the contents of this data.
unsigned long convertUnsignedLong() const
Data xmlCharDataEncode() const
Performs in-place XML Character Data escaping of a Data.
bool empty() const noexcept
Checks whether the Data is empty.
static Data from(const T &x)
Converts from arbitrary other type to Data.
const char * begin() const noexcept
Returns a pointer to the beginning of the buffer used by the Data.
Implementation of a persistence manager.
virtual void initialSync(unsigned int connectionId)
virtual void addHandler(InMemorySyncPubDbHandler *handler)
virtual void removeHandler(InMemorySyncPubDbHandler *handler)
Implementation of a persistence manager.
virtual void addHandler(InMemorySyncRegDbHandler *handler)
virtual void initialSync(unsigned int connectionId)
virtual void getContacts(const Uri &aor, ContactList &container)
virtual void removeHandler(InMemorySyncRegDbHandler *handler)
Provides string-parsing functionality with protection from buffer overflow.
iterator end()
Returns an iterator pointing to the last header field value.
iterator begin()
Returns an iterator pointing to the first header field value.
const Data & getSigner() const
SignatureStatus getSignatureStatus() const
IdentityStrength getIdentityStrength() const
const Data & getIdentity() const
static uint64_t getTimeSecs()
Returns the current clock time in seconds.
bool onlyUseExistingConnection
static void writeBinaryToken(const Tuple &tuple, Data &container, const Data &salt=Data::Empty)
TransportType getType() const
Represents the "SIP-URI" and "SIPS-URI" elements in the RFC 3261 grammar.
const Data & getValue() const
const Data & getTag() const
This Class is used to implement a primitive form of RPC using loose XML formatting.
dcm! – add UnusedChecking(_enum) below;
bool isEqualNoCase(const Data &left, const Data &right)
static const uint64_t NeverExpire
IpVersion
An enumeration of IP versions.
std::list< ContactInstanceRecord > ContactList
unsigned __int64 uint64_t