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


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 |
Definition at line 13 of file IdentityHandler.hxx.
typedef std::map<Data, SipMessage*> resip::IdentityHandler::RequiresCerts [private] |
Definition at line 25 of file IdentityHandler.hxx.
| 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;
}
}
| 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;
}

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

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

Definition at line 26 of file IdentityHandler.hxx.
Referenced by processIdentityCheckResponse(), queueForIdentityCheck(), and ~IdentityHandler().
1.7.5.1