|
reSIProcate/DialogUsageManager
9694
|
#include <ServerPublication.hxx>


Definition at line 12 of file ServerPublication.hxx.
Definition at line 15 of file ServerPublication.hxx.
| ServerPublication::~ServerPublication | ( | ) | [protected, virtual] |
Definition at line 23 of file ServerPublication.cxx.
References getEtag(), resip::BaseUsage::mDum, and resip::DialogUsageManager::mServerPublications.
{
mDum.mServerPublications.erase(getEtag());
}

| ServerPublication::ServerPublication | ( | DialogUsageManager & | dum, |
| const Data & | etag, | ||
| const SipMessage & | request | ||
| ) | [private] |
Definition at line 12 of file ServerPublication.cxx.
References value.
: BaseUsage(dum), mLastResponse(new SipMessage), mEtag(etag), mEventType(msg.header(h_Event).value()), mTimerSeq(0) { }
| SharedPtr< SipMessage > ServerPublication::accept | ( | int | statusCode = 200 | ) |
Definition at line 73 of file ServerPublication.cxx.
References resip::Helper::makeResponse(), mExpires, mLastRequest, mLastResponse, and updateMatchingSubscriptions().
{
Helper::makeResponse(*mLastResponse, mLastRequest, statusCode);
mLastResponse->header(h_Expires).value() = mExpires;
updateMatchingSubscriptions();
return mLastResponse;
}

| void ServerPublication::dispatch | ( | const SipMessage & | msg | ) | [virtual] |
Implements resip::BaseUsage.
Definition at line 98 of file ServerPublication.cxx.
References resip::SipMessage::exists(), resip::Helper::extractFromPkcs7(), resip::SipMessage::getContents(), getHandle(), resip::DialogUsageManager::getSecurity(), resip::DialogUsageManager::getServerPublicationHandler(), resip::SipMessage::header(), resip::SipMessage::isRequest(), resip::Helper::makeResponse(), resip::Helper::ContentsSecAttrs::mAttributes, resip::Helper::ContentsSecAttrs::mContents, resip::BaseUsage::mDum, mEtag, mEventType, mExpires, mLastBody, mLastRequest, mLastResponse, and resip::DialogUsageManager::send().
Referenced by resip::DialogUsageManager::processPublish().
{
assert(msg.isRequest());
ServerPublicationHandler* handler = mDum.getServerPublicationHandler(mEventType);
mLastRequest = msg;
mExpires = 3600; //bad
if (msg.exists(h_Expires))
{
mExpires = msg.header(h_Expires).value();
}
if (msg.exists(h_SIPIfMatch))
{
if (mExpires == 0)
{
handler->onRemoved(getHandle(), mEtag, msg, mExpires);
Helper::makeResponse(*mLastResponse, mLastRequest, 200);
mLastResponse->header(h_Expires).value() = mExpires;
mDum.send(mLastResponse);
delete this;
return;
}
mLastBody = Helper::extractFromPkcs7(msg, *mDum.getSecurity());
if (msg.getContents())
{
handler->onUpdate(getHandle(), mEtag, msg,
mLastBody.mContents.get(),
mLastBody.mAttributes.get(),
mExpires);
}
else
{
handler->onRefresh(getHandle(), mEtag, msg,
mLastBody.mContents.get(),
mLastBody.mAttributes.get(),
mExpires);
}
}
else
{
mLastBody = Helper::extractFromPkcs7(msg, *mDum.getSecurity());
handler->onInitial(getHandle(), mEtag, msg,
mLastBody.mContents.get(),
mLastBody.mAttributes.get(),
mExpires);
}
}

| void ServerPublication::dispatch | ( | const DumTimeout & | timer | ) | [virtual] |
Implements resip::BaseUsage.
Definition at line 146 of file ServerPublication.cxx.
References getHandle(), resip::DialogUsageManager::getServerPublicationHandler(), resip::BaseUsage::mDum, mEtag, mEventType, mTimerSeq, resip::ServerPublicationHandler::onExpired(), and resip::DumTimeout::seq().
{
if (msg.seq() == mTimerSeq)
{
ServerPublicationHandler* handler = mDum.getServerPublicationHandler(mEventType);
handler->onExpired(getHandle(), mEtag);
delete this;
}
}

| EncodeStream & ServerPublication::dump | ( | EncodeStream & | strm | ) | const [virtual] |
Implements resip::BaseUsage.
Definition at line 173 of file ServerPublication.cxx.
References mDocumentKey, and mEventType.
{
strm << "ServerPublication " << mDocumentKey << " " << mEventType;
return strm;
}
| void ServerPublication::end | ( | ) | [virtual] |
| const Data & ServerPublication::getDocumentKey | ( | ) | const |
Definition at line 41 of file ServerPublication.cxx.
References mDocumentKey.
{
return mDocumentKey;
}
| const Data & ServerPublication::getEtag | ( | ) | const |
Definition at line 35 of file ServerPublication.cxx.
References mEtag.
Referenced by ~ServerPublication().
{
return mEtag;
}
| ServerPublicationHandle ServerPublication::getHandle | ( | ) |
Definition at line 29 of file ServerPublication.cxx.
References resip::BaseUsage::getBaseHandle(), and resip::BaseUsage::mDum.
Referenced by dispatch(), and updateMatchingSubscriptions().
{
return ServerPublicationHandle(mDum, getBaseHandle().getId());
}

| Data ServerPublication::getPublisher | ( | ) | const |
Definition at line 47 of file ServerPublication.cxx.
References resip::Uri::getAor(), resip::SipMessage::header(), mLastRequest, and resip::RequestLine::uri().
{
return mLastRequest.header(h_From).uri().getAor();
}

| SharedPtr< SipMessage > ServerPublication::reject | ( | int | responseCode | ) |
Definition at line 84 of file ServerPublication.cxx.
References resip::Helper::makeResponse(), mExpires, mLastRequest, and mLastResponse.
{
Helper::makeResponse(*mLastResponse, mLastRequest, statusCode);
mLastResponse->header(h_Expires).value() = mExpires;
return mLastResponse;
}

| void ServerPublication::send | ( | SharedPtr< SipMessage > | response | ) |
Definition at line 157 of file ServerPublication.cxx.
References resip::DialogUsageManager::addTimer(), resip::BaseUsage::getBaseHandle(), h_StatusLine, resip::BaseUsage::mDum, mEtag, mTimerSeq, resip::DumTimeout::Publication, and resip::DialogUsageManager::send().
{
assert(response->isResponse());
response->header(h_SIPETag).value() = mEtag;
mDum.send(response);
if (response->header(h_StatusLine).statusCode() >= 300)
{
delete this;
}
else
{
mDum.addTimer(DumTimeout::Publication, response->header(h_Expires).value(), getBaseHandle(), ++mTimerSeq);
}
}

| void ServerPublication::updateMatchingSubscriptions | ( | ) | [protected] |
Definition at line 53 of file ServerPublication.cxx.
References resip::Uri::getAor(), getHandle(), resip::DialogUsageManager::getServerSubscriptionHandler(), h_RequestLine, resip::SipMessage::header(), resip::Helper::ContentsSecAttrs::mAttributes, resip::Helper::ContentsSecAttrs::mContents, resip::BaseUsage::mDum, mEventType, mLastBody, mLastRequest, resip::DialogUsageManager::mServerSubscriptions, resip::ServerSubscriptionHandler::onPublished(), and resip::RequestLine::uri().
Referenced by accept().
{
Data key = mEventType + mLastRequest.header(h_RequestLine).uri().getAor();
std::pair<DialogUsageManager::ServerSubscriptions::iterator,DialogUsageManager::ServerSubscriptions::iterator> subs;
subs = mDum.mServerSubscriptions.equal_range(key);
ServerSubscriptionHandler* handler = mDum.getServerSubscriptionHandler(mEventType);
for (DialogUsageManager::ServerSubscriptions::iterator i=subs.first; i!=subs.second; ++i)
{
handler->onPublished(i->second->getHandle(),
getHandle(),
mLastBody.mContents.get(),
mLastBody.mAttributes.get());
}
mLastBody.mContents.reset();
mLastBody.mAttributes.reset();
}

friend class DialogUsageManager [friend] |
Reimplemented from resip::BaseUsage.
Definition at line 39 of file ServerPublication.hxx.
const Data resip::ServerPublication::mDocumentKey [private] |
Definition at line 46 of file ServerPublication.hxx.
Referenced by dump(), and getDocumentKey().
const Data resip::ServerPublication::mEtag [private] |
Definition at line 44 of file ServerPublication.hxx.
Referenced by dispatch(), getEtag(), and send().
const Data resip::ServerPublication::mEventType [private] |
Definition at line 45 of file ServerPublication.hxx.
Referenced by dispatch(), dump(), and updateMatchingSubscriptions().
UInt32 resip::ServerPublication::mExpires [private] |
Definition at line 49 of file ServerPublication.hxx.
Referenced by accept(), dispatch(), and reject().
Definition at line 47 of file ServerPublication.hxx.
Referenced by dispatch(), and updateMatchingSubscriptions().
Definition at line 42 of file ServerPublication.hxx.
Referenced by accept(), dispatch(), getPublisher(), reject(), and updateMatchingSubscriptions().
Definition at line 43 of file ServerPublication.hxx.
Referenced by accept(), dispatch(), and reject().
unsigned int resip::ServerPublication::mTimerSeq [private] |
Definition at line 48 of file ServerPublication.hxx.
Referenced by dispatch(), and send().
1.7.5.1