reSIProcate/DialogUsageManager  9694
Public Member Functions | Private Types | Private Member Functions | Private Attributes
resip::IdentityHandler Class Reference

#include <IdentityHandler.hxx>

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

List of all members.

Public Member Functions

 IdentityHandler (DialogUsageManager &dum, TargetCommand::Target &target)
 ~IdentityHandler ()
virtual ProcessingResult process (Message *msg)

Private Types

typedef std::map< Data,
SipMessage * > 
RequiresCerts

Private Member Functions

void processIdentityCheckResponse (const HttpGetMessage &msg)
bool queueForIdentityCheck (SipMessage *sipMsg)

Private Attributes

RequiresCerts mRequiresCerts

Detailed Description

Definition at line 13 of file IdentityHandler.hxx.


Member Typedef Documentation

typedef std::map<Data, SipMessage*> resip::IdentityHandler::RequiresCerts [private]

Definition at line 25 of file IdentityHandler.hxx.


Constructor & Destructor Documentation

IdentityHandler::IdentityHandler ( DialogUsageManager dum,
TargetCommand::Target target 
)

Definition at line 23 of file IdentityHandler.cxx.

   : DumFeature(dum, target)
{
}
IdentityHandler::~IdentityHandler ( )

Definition at line 28 of file IdentityHandler.cxx.

References mRequiresCerts.

{
   for (RequiresCerts::iterator it = mRequiresCerts.begin(); it != mRequiresCerts.end(); ++it)
   {
      delete it->second;
   }
}

Member Function Documentation

DumFeature::ProcessingResult IdentityHandler::process ( Message msg) [virtual]

Implements resip::DumFeature.

Definition at line 37 of file IdentityHandler.cxx.

References resip::DumFeature::EventTaken, resip::DumFeature::FeatureDone, resip::DumFeature::FeatureDoneAndEventDone, processIdentityCheckResponse(), and queueForIdentityCheck().

{
   SipMessage* sipMsg = dynamic_cast<SipMessage*>(msg);
   if (sipMsg)
   {
      if (queueForIdentityCheck(sipMsg))
      {
         return EventTaken;
      }
      else
      {
         return FeatureDone;
      }
   }
   
   HttpGetMessage* httpMsg = dynamic_cast<HttpGetMessage*>(msg);
   if (httpMsg)
   {
      processIdentityCheckResponse(*httpMsg);         
      return FeatureDoneAndEventDone;         
   }

   return FeatureDone;   
}

Here is the call graph for this function:

void IdentityHandler::processIdentityCheckResponse ( const HttpGetMessage msg) [private]

Definition at line 109 of file IdentityHandler.cxx.

References resip::Message::brief(), resip::BaseSecurity::checkAndSetIdentity(), resip::HttpGetMessage::getBodyData(), resip::DialogUsageManager::getSecurity(), resip::DumFeatureMessage::getTransactionId(), InfoLog, resip::DumFeature::mDum, mRequiresCerts, and resip::DumFeature::postCommand().

Referenced by process().

{
#if defined(USE_SSL)
   InfoLog(<< "DialogUsageManager::processIdentityCheckResponse: " << msg.brief());   
   RequiresCerts::iterator it = mRequiresCerts.find(msg.getTransactionId());
   if (it != mRequiresCerts.end())
   {
      mDum.getSecurity()->checkAndSetIdentity( *it->second, msg.getBodyData() );
      postCommand(auto_ptr<Message>(it->second));
      mRequiresCerts.erase(it);
   }
#endif
}

Here is the call graph for this function:

bool IdentityHandler::queueForIdentityCheck ( SipMessage sipMsg) [private]

Definition at line 63 of file IdentityHandler.cxx.

References resip::BaseSecurity::checkAndSetIdentity(), resip::DialogUsageManager::dumIncomingTarget(), resip::SipMessage::exists(), resip::SecurityAttributes::From, resip::HttpProvider::get(), resip::Uri::getAor(), resip::DialogUsageManager::getSecurity(), resip::SipMessage::getTransactionId(), resip::BaseSecurity::hasDomainCert(), resip::SipMessage::header(), resip::Uri::host(), InfoLog, resip::HttpProvider::instance(), resip::DumFeature::mDum, mRequiresCerts, resip::SipMessage::setSecurityAttributes(), and resip::RequestLine::uri().

Referenced by process().

{
#if defined(USE_SSL)
   if (sipMsg->exists(h_Identity) &&
       sipMsg->exists(h_IdentityInfo) &&
       sipMsg->exists(h_Date))
   {
      if (mDum.getSecurity()->hasDomainCert(sipMsg->header(h_From).uri().host()))
      {
         mDum.getSecurity()->checkAndSetIdentity(*sipMsg);
         return false;
      }
      else
      {
         if (!HttpProvider::instance())
         {
            return false;
         }
         
         try
         {
            mRequiresCerts[sipMsg->getTransactionId()] = sipMsg;
            InfoLog( << "Dum::queueForIdentityCheck, sending http request to: " 
                     << sipMsg->header(h_IdentityInfo));
            
            HttpProvider::instance()->get(sipMsg->header(h_IdentityInfo), 
                                          sipMsg->getTransactionId(),
                                          mDum,
                                          mDum.dumIncomingTarget());
            return true;
         }
         catch (BaseException&)
         {
         }
      }
   }
#endif

   std::auto_ptr<SecurityAttributes> sec(new SecurityAttributes);
   sec->setIdentity(sipMsg->header(h_From).uri().getAor());
   sec->setIdentityStrength(SecurityAttributes::From);
   sipMsg->setSecurityAttributes(sec);
   return false;
}

Here is the call graph for this function:


Member Data Documentation


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