reSIProcate/stack  9694
Public Member Functions | Private Attributes
resip::BasicNonceHelper Class Reference

Implements the makeNonce function in the same way as the original implementation of makeNonce within Helper.cxx. More...

#include <BasicNonceHelper.hxx>

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

List of all members.

Public Member Functions

 BasicNonceHelper ()
 BasicNonceHelper implements the makeNonce function in the same way as the original implementation of makeNonce within Helper.cxx.
virtual ~BasicNonceHelper ()
void setPrivateKey (const Data &privateKey)
Data makeNonce (const SipMessage &request, const Data &timestamp)
Nonce parseNonce (const Data &nonce)

Private Attributes

Data privateKey

Detailed Description

Implements the makeNonce function in the same way as the original implementation of makeNonce within Helper.cxx.

To operate a farm/cluster of UASs/proxies, you must:

  1. make sure the clocks are sychronized (using ntpd for instance)
  2. use the same privateKey value on every instance of the application

To operate with SER, use the SERNonceHelper instead, as that generates the nonce string the same way as SER. You must also observe the same conditions above regarding clock and key synchronization.

Definition at line 25 of file BasicNonceHelper.hxx.


Constructor & Destructor Documentation

BasicNonceHelper::BasicNonceHelper ( )

BasicNonceHelper implements the makeNonce function in the same way as the original implementation of makeNonce within Helper.cxx.

To operate a farm/cluster of UASs/proxies, you must: a) make sure the clocks are sychronized (using ntpd for instance) b) use the same privateKey value on every instance of the application

To operate with SER, use the SERNonceHelper instead, as that generates the nonce string the same way as SER. You must also observe the same conditions above regarding clock and key synchronization.

Definition at line 25 of file BasicNonceHelper.cxx.

References resip::Random::getRandomHex(), and privateKey.

{
  //privateKey = Data("asdfklsadflkj");
  privateKey = Random::getRandomHex(24);
}

Here is the call graph for this function:

BasicNonceHelper::~BasicNonceHelper ( ) [virtual]

Definition at line 31 of file BasicNonceHelper.cxx.

{
}

Member Function Documentation

Data BasicNonceHelper::makeNonce ( const SipMessage request,
const Data timestamp 
) [virtual]

Implements resip::NonceHelper.

Definition at line 42 of file BasicNonceHelper.cxx.

References resip::Symbols::COLON, resip::SipMessage::header(), resip::Data::md5(), resip::Data::Preallocate, privateKey, resip::RequestLine::uri(), and resip::Uri::user().

{
   Data nonce(100, Data::Preallocate);
   nonce += timestamp;
   nonce += Symbols::COLON;
   Data noncePrivate(100, Data::Preallocate);
   noncePrivate += timestamp;
   noncePrivate += Symbols::COLON;
   // !jf! don't include the Call-Id since it might not be the same.
   // noncePrivate += request.header(h_CallId).value();
   noncePrivate += request.header(h_From).uri().user();
   noncePrivate += privateKey;
   nonce += noncePrivate.md5();
   return nonce;
}

Here is the call graph for this function:

NonceHelper::Nonce BasicNonceHelper::parseNonce ( const Data nonce) [virtual]

Implements resip::NonceHelper.

Definition at line 59 of file BasicNonceHelper.cxx.

References resip::Symbols::COLON, resip::Data::convertUInt64(), resip::Data::data(), DebugLog, and resip::Data::size().

{
   ParseBuffer pb(nonce.data(), nonce.size());
   if (!pb.eof() && !isdigit(*pb.position()))
   {
      DebugLog(<< "Invalid nonce; expected timestamp.");
      return BasicNonceHelper::Nonce(0);
   }
   const char* anchor = pb.position();
   pb.skipToChar(Symbols::COLON[0]);
   if (pb.eof())
   {
      DebugLog(<< "Invalid nonce; expected timestamp terminator.");
      return BasicNonceHelper::Nonce(0);
   }
   Data creationTime;
   pb.data(creationTime, anchor);
   return BasicNonceHelper::Nonce(creationTime.convertUInt64());
}

Here is the call graph for this function:

void BasicNonceHelper::setPrivateKey ( const Data privateKey)

Definition at line 36 of file BasicNonceHelper.cxx.

References privateKey.

{
  this->privateKey = pprivateKey;
}

Member Data Documentation

Definition at line 28 of file BasicNonceHelper.hxx.

Referenced by BasicNonceHelper(), makeNonce(), and setPrivateKey().


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