reSIProcate/DialogUsageManager  9694
Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Friends
resip::ServerPublication Class Reference

#include <ServerPublication.hxx>

Inheritance diagram for resip::ServerPublication:
Inheritance graph
[legend]
Collaboration diagram for resip::ServerPublication:
Collaboration graph
[legend]

List of all members.

Public Types

typedef Handle< ServerPublicationServerPublicationHandle

Public Member Functions

ServerPublicationHandle getHandle ()
const DatagetEtag () const
const DatagetDocumentKey () const
SharedPtr< SipMessageaccept (int statusCode=200)
SharedPtr< SipMessagereject (int responseCode)
virtual void end ()
virtual void dispatch (const SipMessage &msg)
virtual void dispatch (const DumTimeout &timer)
void send (SharedPtr< SipMessage > response)
Data getPublisher () const
virtual EncodeStreamdump (EncodeStream &strm) const

Protected Member Functions

virtual ~ServerPublication ()
void updateMatchingSubscriptions ()

Private Member Functions

 ServerPublication (DialogUsageManager &dum, const Data &etag, const SipMessage &request)

Private Attributes

SipMessage mLastRequest
SharedPtr< SipMessagemLastResponse
const Data mEtag
const Data mEventType
const Data mDocumentKey
Helper::ContentsSecAttrs mLastBody
unsigned int mTimerSeq
UInt32 mExpires

Friends

class DialogUsageManager

Detailed Description

Definition at line 12 of file ServerPublication.hxx.


Member Typedef Documentation

Definition at line 15 of file ServerPublication.hxx.


Constructor & Destructor Documentation

ServerPublication::~ServerPublication ( ) [protected, virtual]

Definition at line 23 of file ServerPublication.cxx.

References getEtag(), resip::BaseUsage::mDum, and resip::DialogUsageManager::mServerPublications.

Here is the call graph for this function:

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)
{
}

Member Function Documentation

SharedPtr< SipMessage > ServerPublication::accept ( int  statusCode = 200)

Definition at line 73 of file ServerPublication.cxx.

References resip::Helper::makeResponse(), mExpires, mLastRequest, mLastResponse, and updateMatchingSubscriptions().

Here is the call graph for this function:

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);
   }
}

Here is the call graph for this function:

void ServerPublication::dispatch ( const DumTimeout timer) [virtual]
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]

Implements resip::BaseUsage.

Definition at line 92 of file ServerPublication.cxx.

{
   delete this;
}
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());
}

Here is the call graph for this function:

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();
}

Here is the call graph for this function:

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;  
}

Here is the call graph for this function:

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);
   }
}

Here is the call graph for this function:

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();
}

Here is the call graph for this function:


Friends And Related Function Documentation

friend class DialogUsageManager [friend]

Reimplemented from resip::BaseUsage.

Definition at line 39 of file ServerPublication.hxx.


Member Data Documentation

Definition at line 46 of file ServerPublication.hxx.

Referenced by dump(), and getDocumentKey().

Definition at line 44 of file ServerPublication.hxx.

Referenced by dispatch(), getEtag(), and send().

Definition at line 45 of file ServerPublication.hxx.

Referenced by dispatch(), dump(), and updateMatchingSubscriptions().

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 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().


The documentation for this class was generated from the following files: