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

#include <SERNonceHelper.hxx>

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

List of all members.

Public Member Functions

 SERNonceHelper (int serOffset)
 SERNonceHelper implements the makeNonce function in the same way as SIP Express Router (SER) - http://www.iptel.org/ser.
virtual ~SERNonceHelper ()
void setPrivateKey (const Data &privateKey)
Data makeNonce (const SipMessage &request, const Data &timestamp)
Nonce parseNonce (const Data &nonce)

Private Attributes

Data privateKey
int serOffset

Detailed Description

Definition at line 23 of file SERNonceHelper.hxx.


Constructor & Destructor Documentation

SERNonceHelper::SERNonceHelper ( int  serOffset)

SERNonceHelper implements the makeNonce function in the same way as SIP Express Router (SER) - http://www.iptel.org/ser.

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 c) call Helper::setNonceHelper(mySERNonceHelper) to over-ride the default implementation of NonceHelper in the reSIProcate stack

Definition at line 24 of file SERNonceHelper.cxx.

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

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

Here is the call graph for this function:

SERNonceHelper::~SERNonceHelper ( ) [virtual]

Definition at line 30 of file SERNonceHelper.cxx.

{
}

Member Function Documentation

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

Implements resip::NonceHelper.

Definition at line 41 of file SERNonceHelper.cxx.

References resip::Data::append(), resip::Data::convertInt(), resip::Helper::integer2hex(), resip::Data::md5(), resip::Data::Preallocate, privateKey, and serOffset.

{
   char buf[8];
   Data md5buf(8, Data::Preallocate);
   Data nonce(40, Data::Preallocate);
   int ts = timestamp.convertInt() + serOffset;
   Helper::integer2hex(buf, ts);
   md5buf.append(buf, 8);
   nonce.append(buf, 8);
   md5buf += privateKey;
   nonce += md5buf.md5(); 
   return nonce;
}

Here is the call graph for this function:

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

Implements resip::NonceHelper.

Definition at line 56 of file SERNonceHelper.cxx.

References resip::Data::data(), resip::Helper::hex2integer(), serOffset, and resip::Data::size().

{
   if(nonce.size() != 40)
   {
      return SERNonceHelper::Nonce(0);
   }
   const char *s = nonce.data();
   unsigned int ts = Helper::hex2integer(s) - serOffset;
   return SERNonceHelper::Nonce(ts); 
}

Here is the call graph for this function:

void SERNonceHelper::setPrivateKey ( const Data privateKey)

Definition at line 35 of file SERNonceHelper.cxx.

References privateKey.

{
   this->privateKey = pprivateKey;
}

Member Data Documentation

Definition at line 26 of file SERNonceHelper.hxx.

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

Definition at line 31 of file SERNonceHelper.hxx.

Referenced by makeNonce(), and parseNonce().


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