|
reSIProcate/stack
9694
|
#include <string.h>#include <iomanip>#include <algorithm>#include <memory>#include "resip/stack/Auth.hxx"#include "resip/stack/BasicNonceHelper.hxx"#include "resip/stack/Helper.hxx"#include "resip/stack/NonceHelper.hxx"#include "rutil/Coders.hxx"#include "resip/stack/Uri.hxx"#include "rutil/Logger.hxx"#include "rutil/Random.hxx"#include "rutil/Timer.hxx"#include "rutil/DataStream.hxx"#include "rutil/MD5Stream.hxx"#include "rutil/DnsUtil.hxx"#include "rutil/compat.hxx"#include "rutil/ParseBuffer.hxx"#include "resip/stack/SipMessage.hxx"#include "resip/stack/Pkcs7Contents.hxx"#include "resip/stack/MultipartSignedContents.hxx"#include "resip/stack/MultipartMixedContents.hxx"#include "resip/stack/MultipartAlternativeContents.hxx"#include "rutil/WinLeakCheck.hxx"
Go to the source code of this file.
Defines | |
| #define | RESIPROCATE_SUBSYSTEM Subsystem::SIP |
Functions | |
| Contents * | extractFromPkcs7Recurse (Contents *tree, const Data &signerAor, const Data &receiverAor, SecurityAttributes *attributes, Security &security) |
| SdpContents * | getSdpRecurse (Contents *tree) |
Variables | |
| static const Data | cookie ("z9hG4bK") |
| static Data | localhostname = DnsUtil::getLocalHostName() |
| static Data | noBody = MD5Stream().getHex() |
| static Data | digest ("digest") |
| static Data | preferredTokens [] |
| static size_t | pTokenSize = sizeof(preferredTokens)/sizeof(*preferredTokens) |
| static std::auto_ptr< SdpContents > | emptysdp |
| #define RESIPROCATE_SUBSYSTEM Subsystem::SIP |
Definition at line 38 of file Helper.cxx.
| Contents* extractFromPkcs7Recurse | ( | Contents * | tree, |
| const Data & | signerAor, | ||
| const Data & | receiverAor, | ||
| SecurityAttributes * | attributes, | ||
| Security & | security | ||
| ) |
Definition at line 1892 of file Helper.cxx.
References resip::BaseSecurity::checkSignature(), resip::Contents::clone(), resip::BaseSecurity::decrypt(), InfoLog, resip::MultipartMixedContents::parts(), and resip::SecurityAttributes::setEncrypted().
Referenced by resip::Helper::extractFromPkcs7().
{
Pkcs7Contents* pk;
if ((pk = dynamic_cast<Pkcs7Contents*>(tree)))
{
InfoLog( << "GREG1: " << *pk );
#if defined(USE_SSL)
Contents* contents = security.decrypt(receiverAor, pk);
if (contents)
{
attributes->setEncrypted();
}
return contents;
#else
return 0;
#endif
}
MultipartSignedContents* mps;
if ((mps = dynamic_cast<MultipartSignedContents*>(tree)))
{
InfoLog( << "GREG2: " << *mps );
#if defined(USE_SSL)
Data signer;
SignatureStatus sigStatus;
Contents* b = extractFromPkcs7Recurse(security.checkSignature(mps,
&signer,
&sigStatus),
signerAor,
receiverAor, attributes, security);
attributes->setSigner(signer);
attributes->setSignatureStatus(sigStatus);
return b->clone();
#else
return mps->parts().front()->clone();
#endif
}
MultipartAlternativeContents* alt;
if ((alt = dynamic_cast<MultipartAlternativeContents*>(tree)))
{
InfoLog( << "GREG3: " << *alt );
for (MultipartAlternativeContents::Parts::reverse_iterator i = alt->parts().rbegin();
i != alt->parts().rend(); ++i)
{
Contents* b = extractFromPkcs7Recurse(*i, signerAor, receiverAor, attributes, security);
if (b)
{
return b;
}
}
}
MultipartMixedContents* mult;
if ((mult = dynamic_cast<MultipartMixedContents*>(tree)))
{
InfoLog( << "GREG4: " << *mult );
for (MultipartMixedContents::Parts::iterator i = mult->parts().begin();
i != mult->parts().end(); ++i)
{
Contents* b = extractFromPkcs7Recurse(*i, signerAor, receiverAor,
attributes, security);
if (b)
{
return b;
}
};
return 0;
}
return tree->clone();
}

| SdpContents* getSdpRecurse | ( | Contents * | tree | ) |
Definition at line 2075 of file Helper.cxx.
References ErrLog, resip::BaseException::getMessage(), resip::BaseException::name(), resip::ParseException::name(), and resip::MultipartMixedContents::parts().
Referenced by resip::Helper::getSdp().
{
if (dynamic_cast<SdpContents*>(tree))
{
return static_cast<SdpContents*>(tree);
}
MultipartSignedContents* mps;
if ((mps = dynamic_cast<MultipartSignedContents*>(tree)))
{
try
{
MultipartSignedContents::Parts::const_iterator it = mps->parts().begin();
Contents* contents = getSdpRecurse(*it);
return static_cast<SdpContents*>(contents);
}
catch (ParseException& e)
{
ErrLog(<< e.name() << endl << e.getMessage());
}
catch (BaseException& e)
{
ErrLog(<< e.name() << endl << e.getMessage());
}
return 0;
}
MultipartAlternativeContents* alt;
if ((alt = dynamic_cast<MultipartAlternativeContents*>(tree)))
{
try
{
for (MultipartAlternativeContents::Parts::reverse_iterator i = alt->parts().rbegin();
i != alt->parts().rend(); ++i)
{
Contents* contents = getSdpRecurse(*i);
if (contents)
{
return static_cast<SdpContents*>(contents);
}
}
}
catch (ParseException& e)
{
ErrLog(<< e.name() << endl << e.getMessage());
}
catch (BaseException& e)
{
ErrLog(<< e.name() << endl << e.getMessage());
}
return 0;
}
MultipartMixedContents* mult;
if ((mult = dynamic_cast<MultipartMixedContents*>(tree)))
{
try
{
for (MultipartMixedContents::Parts::iterator i = mult->parts().begin();
i != mult->parts().end(); ++i)
{
Contents* contents = getSdpRecurse(*i);
if (contents)
{
return static_cast<SdpContents*>(contents);
}
}
}
catch (ParseException& e)
{
ErrLog(<< e.name() << endl << e.getMessage());
}
catch (BaseException& e)
{
ErrLog(<< e.name() << endl << e.getMessage());
}
return 0;
}
return 0;
}

Referenced by resip::Helper::computeUniqueBranch().
std::auto_ptr<SdpContents> emptysdp [static] |
Definition at line 2161 of file Helper.cxx.
Referenced by resip::Helper::getSdp().
Data localhostname = DnsUtil::getLocalHostName() [static] |
Definition at line 648 of file Helper.cxx.
Referenced by resip::Helper::computeCallId().
Definition at line 701 of file Helper.cxx.
Referenced by resip::Helper::makeResponseMD5WithA1().
Data preferredTokens[] [static] |
{
"auth-int",
"auth"
}
Definition at line 1421 of file Helper.cxx.
Referenced by resip::Helper::qopOption().
size_t pTokenSize = sizeof(preferredTokens)/sizeof(*preferredTokens) [static] |
Definition at line 1426 of file Helper.cxx.
Referenced by resip::Helper::qopOption().
1.7.5.1