reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches

An aggregation of useful static functions. More...

#include <Helper.hxx>

Classes

struct  ContentsSecAttrs
 

Public Types

enum  AuthResult { Failed = 1 , Authenticated , Expired , BadlyFormed }
 
enum  FailureMessageEffect {
  DialogTermination , TransactionTermination , UsageTermination , RetryAfter ,
  OptionalRetryAfter , ApplicationDependant
}
 

Static Public Member Functions

template<typename T >
static T aBitSmallerThan (T secs)
 Used by Registration, Publication and Subscription refreshes, to calculate the time at which a refresh should be performed (which is some time, that is a bit smaller than the Expiration interval).
 
static void integer2hex (char *_d, unsigned int _s, bool _l=true)
 Converts an interger in a character string containing the hexidecimal representation of the integer.
 
static unsigned int hex2integer (const char *_s)
 Converts a character string containing a hexidecimal value into an unsigned int.
 
static int jitterValue (int input, int lowerPercentage, int upperPercentage, int minimum=0)
 Used to jitter the expires in a SUBSCRIBE or REGISTER expires header.
 
static SipMessage * makeRequest (const NameAddr &target, const NameAddr &from, const NameAddr &contact, MethodTypes method)
 ///////////////////////////////////////////////////////////////////////////////////////////
 
static SipMessage * makeRequest (const NameAddr &target, const NameAddr &from, MethodTypes method)
 Make a new request.
 
static SipMessage * makeRegister (const NameAddr &to, const NameAddr &from)
 Create a Register request with an empty Contact. See makeRequest.
 
static SipMessage * makeRegister (const NameAddr &to, const NameAddr &from, const NameAddr &contact)
 Create a Register request with an overriden Contact. See makeRequest.
 
static SipMessage * makeRegister (const NameAddr &to, const Data &transport)
 Create a Register request with an empty Contact, transport is added to Request URI. See makeRequest.
 
static SipMessage * makeRegister (const NameAddr &to, const Data &transport, const NameAddr &contact)
 Create a Register request with an overriden Contact, transport is added to Request URI. See makeRequest.
 
static SipMessage * makeInvite (const NameAddr &target, const NameAddr &from)
 Make an invite request - Empty Contact and Via is added and will be populated by the stack when sent.
 
static SipMessage * makeInvite (const NameAddr &target, const NameAddr &from, const NameAddr &contact)
 Make an invite request using a overridden contact header - Empty Via is added and will be populated by the stack when sent.
 
static SipMessage * makeCancel (const SipMessage &request)
 Make a new Cancel request for the specified request.
 
static SipMessage * makeFailureAck (const SipMessage &request, const SipMessage &response)
 This interface should be used by the stack (TransactionState) to create an AckMsg to a failure response.
 
static SipMessage * makePublish (const NameAddr &target, const NameAddr &from)
 Create a Publish request with an empty Contact. See makeRequest.
 
static SipMessage * makePublish (const NameAddr &target, const NameAddr &from, const NameAddr &contact)
 Create a Publish request with an overriden Contact. See makeRequest.
 
static SipMessage * makeMessage (const NameAddr &target, const NameAddr &from)
 Create a Message request with an empty Contact. See makeRequest.
 
static SipMessage * makeMessage (const NameAddr &target, const NameAddr &from, const NameAddr &contact)
 Create a Message request with an overriden Contact. See makeRequest.
 
static SipMessage * makeSubscribe (const NameAddr &target, const NameAddr &from)
 Create a Subscribe request with an empty Contact. See makeRequest.
 
static SipMessage * makeSubscribe (const NameAddr &target, const NameAddr &from, const NameAddr &contact)
 Create a Subscribe request with an overriden Contact. See makeRequest.
 
static void makeResponse (SipMessage &response, const SipMessage &request, int responseCode, const Data &reason=Data::Empty, const Data &hostname=Data::Empty, const Data &warning=Data::Empty)
 Make a response to a provided request.
 
static void makeResponse (SipMessage &response, const SipMessage &request, int responseCode, const NameAddr &myContact, const Data &reason=Data::Empty, const Data &hostname=Data::Empty, const Data &warning=Data::Empty)
 Make a response to a provided request with an overridden Contact.
 
static SipMessage * makeResponse (const SipMessage &request, int responseCode, const Data &reason=Data::Empty, const Data &hostname=Data::Empty, const Data &warning=Data::Empty)
 Make a new response to a provided request.
 
static SipMessage * makeResponse (const SipMessage &request, int responseCode, const NameAddr &myContact, const Data &reason=Data::Empty, const Data &hostname=Data::Empty, const Data &warning=Data::Empty)
 Make a new response to a provided request with an overridden Contact.
 
static void makeRawResponse (Data &rawBuffer, const SipMessage &request, int responseCode, const Data &additionalHeaders=Data::Empty, const Data &body=Data::Empty)
 
static SipMessage * make405 (const SipMessage &request, const int *allowedMethods=0, int nMethods=-1)
 Make a 405 response to a provided request.
 
static void getResponseCodeReason (int responseCode, Data &reason)
 Returns the default reason string for a particular response code.
 
static Data computeUniqueBranch ()
 Creates and returns a unique branch parameter.
 
static Data computeCallId ()
 
static Data computeTag (int numBytes)
 
static void setNonceHelper (NonceHelper *nonceHelper)
 ///////////////////////////////////////////////////////////////////////////////////////////
 
static NonceHelper * getNonceHelper ()
 
static Data makeNonce (const SipMessage &request, const Data &timestamp)
 
static bool isDigestAlgorithmSupported (const Auth &auth, DigestType &digestType)
 
static bool isDigestAlgorithmSupported (const Data &algorithmName, DigestType &digestType)
 
static Data createResipA1HashString (const Data &username, const Data &realm, const Data &password)
 
static Data extractA1FromResipA1HashString (const Data &resipA1HashString, DigestType digestType)
 
static bool isDigestTypeSupportedInResipA1HashString (const Data &resipA1HashString, DigestType digestType)
 
static AuthResult authenticateRequest (const SipMessage &request, const Data &realm, const Data &password, int expiresDelta=0)
 
static AuthResult authenticateRequestWithA1 (const SipMessage &request, const Data &realm, const Data &resipPasswordHashA1, int expiresDelta=0)
 
static AuthResult authenticateRequest (const SipMessage &request, const Data &realm, const Data &passwordOrResipPasswordHashA1, int expiresDelta, bool isPasswordHashResipA1)
 
static std::pair< AuthResult, Data > advancedAuthenticateRequest (const SipMessage &request, const Data &realm, const Data &resipPasswordHashA1, int expiresDelta=0, bool proxyAuthorization=true)
 
static SipMessage * makeProxyChallenge (const SipMessage &request, const Data &realm, bool useAuth=true, bool stale=false, const std::vector< DigestType > &digestTypes=std::vector< DigestType >())
 
static SipMessage * makeWWWChallenge (const SipMessage &request, const Data &realm, bool useAuth=true, bool stale=false, const std::vector< DigestType > &digestTypes=std::vector< DigestType >())
 
static SipMessage * makeChallenge (const SipMessage &request, const Data &realm, bool useAuth=true, bool stale=false, bool proxy=false, const std::vector< DigestType > &digestTypes=std::vector< DigestType >())
 
static void addChallenge (SipMessage &response, const SipMessage &request, const Data &realm, bool useAuth=true, bool stale=false, bool proxy=false, DigestType digestType=MD5)
 
static Data qopOption (const Auth &challenge)
 
static void updateNonceCount (unsigned int &nonceCount, Data &nonceCountString)
 
static bool algorithmAndQopSupported (const Auth &challenge)
 
static bool algorithmAndQopSupported (const Auth &challenge, DigestType &digestType)
 
static SipMessage & addAuthorization (SipMessage &request, const SipMessage &challenge, const Data &username, const Data &password, const Data &cnonce, unsigned int &nonceCount)
 
static Auth makeChallengeResponseAuth (const SipMessage &request, const Data &username, const Data &password, const Auth &challenge, const Data &cnonce, unsigned int &nonceCount, Data &nonceCountString)
 
static void makeChallengeResponseAuth (const SipMessage &request, const Data &username, const Data &password, const Auth &challenge, const Data &cnonce, const Data &authQop, const Data &nonceCountString, Auth &auth)
 
static Auth makeChallengeResponseAuthWithA1 (const SipMessage &request, const Data &username, const Data &resipPasswordHashA1, const Auth &challenge, const Data &cnonce, unsigned int &nonceCount, Data &nonceCountString)
 
static void makeChallengeResponseAuthWithA1 (const SipMessage &request, const Data &username, const Data &resipPasswordHashA1, const Auth &challenge, const Data &cnonce, const Data &authQop, const Data &nonceCountString, Auth &auth)
 
static Data makeResponseMD5WithA1 (const Data &a1, const Data &method, const Data &digestUri, const Data &nonce, const Data &qop=Data::Empty, const Data &cnonce=Data::Empty, const Data &cnonceCount=Data::Empty, const Contents *entityBody=0)
 
static Data makeResponseDigestWithA1 (const Data &a1, const Data &method, const Data &digestUri, const Data &nonce, const Data &qop=Data::Empty, const Data &cnonce=Data::Empty, const Data &cnonceCount=Data::Empty, const Contents *entityBody=0, DigestType digestType=MD5)
 
static Data makeResponseMD5 (const Data &username, const Data &password, const Data &realm, const Data &method, const Data &digestUri, const Data &nonce, const Data &qop=Data::Empty, const Data &cnonce=Data::Empty, const Data &cnonceCount=Data::Empty, const Contents *entityBody=0)
 
static Data makeResponseDigest (const Data &username, const Data &password, const Data &realm, const Data &method, const Data &digestUri, const Data &nonce, const Data &qop=Data::Empty, const Data &cnonce=Data::Empty, const Data &cnonceCount=Data::Empty, const Contents *entityBody=0, DigestType digestType=MD5)
 
static Uri makeUri (const Data &aor, const Data &scheme=Symbols::DefaultSipScheme)
 ///////////////////////////////////////////////////////////////////////////////////////////
 
static void processStrictRoute (SipMessage &request)
 
static int getPortForReply (SipMessage &request)
 
static void massageRoute (const SipMessage &request, NameAddr &route)
 
static Uri fromAor (const Data &aor, const Data &scheme=Symbols::DefaultSipScheme)
 
static bool validateMessage (const SipMessage &message, resip::Data *reason=0)
 
static Data gruuUserPart (const Data &instanceId, const Data &aor, const Data &key)
 
static std::pair< Data, Data > fromGruuUserPart (const Data &gruuUserPart, const Data &key)
 
static ContentsSecAttrs extractFromPkcs7 (const SipMessage &message, Security &security)
 
static FailureMessageEffect determineFailureMessageEffect (const SipMessage &response, const std::set< int > *additionalTransactionTerminatingResponses=NULL)
 
static SdpContents * getSdpRecurse (Contents *tree)
 
static std::unique_ptr< SdpContents > getSdp (Contents *tree)
 
static bool isClientBehindNAT (const SipMessage &request, bool privateToPublicOnly=true)
 Looks at SIP headers and message source for a mismatch to make an assumption that the sender is behind a NAT device.
 
static Tuple getClientPublicAddress (const SipMessage &request)
 Look at Via headers, and find the first public IP address closest to the sending client.
 

Static Public Attributes

static const int tagSize = 4
 bytes in to-tag& from-tag, should prob. live somewhere else
 

Detailed Description

An aggregation of useful static functions.

These are mostly involved with

  • The manufacture of SIP messages (requests and responses). This is of particular importance to app-writers.
  • Digest auth related functions.

Definition at line 37 of file Helper.hxx.

Member Enumeration Documentation

◆ AuthResult

Enumerator
Failed 
Authenticated 
Expired 
BadlyFormed 

Definition at line 425 of file Helper.hxx.

◆ FailureMessageEffect

Enumerator
DialogTermination 
TransactionTermination 
UsageTermination 
RetryAfter 
OptionalRetryAfter 
ApplicationDependant 

Definition at line 614 of file Helper.hxx.

Member Function Documentation

◆ aBitSmallerThan()

template<typename T >
static T resip::Helper::aBitSmallerThan ( T  secs)
inlinestatic

Used by Registration, Publication and Subscription refreshes, to calculate the time at which a refresh should be performed (which is some time, that is a bit smaller than the Expiration interval).

The recommended calculation from the RFC's is the minimnum of the Exipiration interval less 5 seconds and nine tenths of the exipiration interval.

Definition at line 53 of file Helper.hxx.

◆ addAuthorization()

SipMessage & Helper::addAuthorization ( SipMessage &  request,
const SipMessage &  challenge,
const Data &  username,
const Data &  password,
const Data &  cnonce,
unsigned int &  nonceCount 
)
static

Definition at line 1368 of file Helper.cxx.

◆ addChallenge()

void Helper::addChallenge ( SipMessage &  response,
const SipMessage &  request,
const Data &  realm,
bool  useAuth = true,
bool  stale = false,
bool  proxy = false,
DigestType  digestType = MD5 
)
static

Definition at line 1250 of file Helper.cxx.

◆ advancedAuthenticateRequest()

std::pair< Helper::AuthResult, Data > Helper::advancedAuthenticateRequest ( const SipMessage &  request,
const Data &  realm,
const Data &  resipPasswordHashA1,
int  expiresDelta = 0,
bool  proxyAuthorization = true 
)
static

Definition at line 1071 of file Helper.cxx.

◆ algorithmAndQopSupported() [1/2]

bool Helper::algorithmAndQopSupported ( const Auth &  challenge)
static

Definition at line 1347 of file Helper.cxx.

◆ algorithmAndQopSupported() [2/2]

bool Helper::algorithmAndQopSupported ( const Auth &  challenge,
DigestType &  digestType 
)
static

Definition at line 1354 of file Helper.cxx.

◆ authenticateRequest() [1/2]

Helper::AuthResult Helper::authenticateRequest ( const SipMessage &  request,
const Data &  realm,
const Data &  password,
int  expiresDelta = 0 
)
static

Definition at line 875 of file Helper.cxx.

◆ authenticateRequest() [2/2]

Helper::AuthResult Helper::authenticateRequest ( const SipMessage &  request,
const Data &  realm,
const Data &  passwordOrResipPasswordHashA1,
int  expiresDelta,
bool  isPasswordHashResipA1 
)
static

Definition at line 894 of file Helper.cxx.

◆ authenticateRequestWithA1()

Helper::AuthResult Helper::authenticateRequestWithA1 ( const SipMessage &  request,
const Data &  realm,
const Data &  resipPasswordHashA1,
int  expiresDelta = 0 
)
static

Definition at line 884 of file Helper.cxx.

◆ computeCallId()

Data Helper::computeCallId ( )
static

Definition at line 690 of file Helper.cxx.

◆ computeTag()

Data Helper::computeTag ( int  numBytes)
static

Definition at line 713 of file Helper.cxx.

◆ computeUniqueBranch()

Data Helper::computeUniqueBranch ( )
static

Creates and returns a unique branch parameter.

Generated branch will contain the RFC3261 magic cookie + 4 randome hex characters + "C1" + 2 random hex characters.

Deprecated:
Not used by stack.

Definition at line 679 of file Helper.cxx.

◆ createResipA1HashString()

Data Helper::createResipA1HashString ( const Data &  username,
const Data &  realm,
const Data &  password 
)
static

Definition at line 783 of file Helper.cxx.

◆ determineFailureMessageEffect()

Helper::FailureMessageEffect Helper::determineFailureMessageEffect ( const SipMessage &  response,
const std::set< int > *  additionalTransactionTerminatingResponses = NULL 
)
static

Definition at line 2151 of file Helper.cxx.

◆ extractA1FromResipA1HashString()

Data Helper::extractA1FromResipA1HashString ( const Data &  resipA1HashString,
DigestType  digestType 
)
static

Definition at line 822 of file Helper.cxx.

◆ extractFromPkcs7()

Helper::ContentsSecAttrs Helper::extractFromPkcs7 ( const SipMessage &  message,
Security &  security 
)
static

Definition at line 2124 of file Helper.cxx.

◆ fromAor()

Uri Helper::fromAor ( const Data &  aor,
const Data &  scheme = Symbols::DefaultSipScheme 
)
static

Definition at line 1785 of file Helper.cxx.

◆ fromGruuUserPart()

std::pair< Data, Data > Helper::fromGruuUserPart ( const Data &  gruuUserPart,
const Data &  key 
)
static

Definition at line 1955 of file Helper.cxx.

◆ getClientPublicAddress()

Tuple Helper::getClientPublicAddress ( const SipMessage &  request)
static

Look at Via headers, and find the first public IP address closest to the sending client.

Parameters
requestRequest message that we use for checking.
Note
If no public IP's are found, then an empty Tuple is returned. This can be tested by checking if Tuple::getType() returns UNKNOWN_TRANSPORT.

Definition at line 2400 of file Helper.cxx.

◆ getNonceHelper()

NonceHelper * Helper::getNonceHelper ( )
static

Definition at line 725 of file Helper.cxx.

◆ getPortForReply()

int Helper::getPortForReply ( SipMessage &  request)
static

Definition at line 1741 of file Helper.cxx.

◆ getResponseCodeReason()

void Helper::getResponseCodeReason ( int  responseCode,
Data &  reason 
)
static

Returns the default reason string for a particular response code.

Parameters
responseCodeResponse code to get reason for
reasonData where the reason string associated with the responseCode will be set.

Definition at line 610 of file Helper.cxx.

◆ getSdp()

unique_ptr< SdpContents > Helper::getSdp ( Contents *  tree)
static

Definition at line 2339 of file Helper.cxx.

◆ getSdpRecurse()

SdpContents * Helper::getSdpRecurse ( Contents *  tree)
static

Definition at line 2238 of file Helper.cxx.

◆ gruuUserPart()

Data Helper::gruuUserPart ( const Data &  instanceId,
const Data &  aor,
const Data &  key 
)
static

Definition at line 1866 of file Helper.cxx.

◆ hex2integer()

unsigned int Helper::hex2integer ( const char *  _s)
static

Converts a character string containing a hexidecimal value into an unsigned int.

Note: Parsing stops after the first non-hex character, or after 8 characters have been processed.

Parameters
_sA pointer to the character buffer to convert.
Returns
The integer value of the coverted hex string.

Definition at line 92 of file Helper.cxx.

◆ integer2hex()

void Helper::integer2hex ( char *  _d,
unsigned int  _s,
bool  _l = true 
)
static

Converts an interger in a character string containing the hexidecimal representation of the integer.

Note: The string buffer provided should be at least 8 characters long. This function will NOT NULL terminate the string.

Parameters
_dA pointer to the character buffer to write the hex string
_sThe integer value to convert.
_lBoolean flag to include leading 0 zeros or not.

Definition at line 52 of file Helper.cxx.

◆ isClientBehindNAT()

bool Helper::isClientBehindNAT ( const SipMessage &  request,
bool  privateToPublicOnly = true 
)
static

Looks at SIP headers and message source for a mismatch to make an assumption that the sender is behind a NAT device.

Parameters
requestRequest message that we use for checking.

@privateToPublicOnly If enabled then we ensure that the via is private address and that the source was a public address. This allows us to ignore cases of private-private NAT'ing or false detections, when a server behind a load balancer is sending us requests and using the load balancer address in the Via, instead of the real of the adapter.

Definition at line 2357 of file Helper.cxx.

◆ isDigestAlgorithmSupported() [1/2]

bool Helper::isDigestAlgorithmSupported ( const Auth &  auth,
DigestType &  digestType 
)
static

Definition at line 742 of file Helper.cxx.

◆ isDigestAlgorithmSupported() [2/2]

bool Helper::isDigestAlgorithmSupported ( const Data &  algorithmName,
DigestType &  digestType 
)
static

Definition at line 756 of file Helper.cxx.

◆ isDigestTypeSupportedInResipA1HashString()

bool Helper::isDigestTypeSupportedInResipA1HashString ( const Data &  resipA1HashString,
DigestType  digestType 
)
static

Definition at line 856 of file Helper.cxx.

◆ jitterValue()

int Helper::jitterValue ( int  input,
int  lowerPercentage,
int  upperPercentage,
int  minimum = 0 
)
static

Used to jitter the expires in a SUBSCRIBE or REGISTER expires header.

Parameters
inputValue to jitter
lowerPercentageThe lower range of the random percentage by which to jitter the value by.
upperPercentageThe upper range of the random percentage by which to jitter the value by. Must be greater than or equal to lowerPercentage
minimumOnly jitter the input if greater than minimum

Definition at line 123 of file Helper.cxx.

◆ make405()

SipMessage * Helper::make405 ( const SipMessage &  request,
const int *  allowedMethods = 0,
int  nMethods = -1 
)
static

Make a 405 response to a provided request.

Allows header is added with specified methods, or with all methods the stack knows about. Caller owns the returned pointer and is responsible for deleting it.

Parameters
requestSipMessage request from which to generate the response
allowedMethodsArray of integers representing a list of Method Types to add to the generated Allows header. See MethodTypes.hxx.
nMethodsNumber of methods specified in the allowedMethods integer array. Specify -1 to have this method fill in the Allows header automatically with each method supported by the stack.
Returns
SipMessage populated with the appropriate response.
Caller must deallocate.

Definition at line 573 of file Helper.cxx.

◆ makeCancel()

SipMessage * Helper::makeCancel ( const SipMessage &  request)
static

Make a new Cancel request for the specified request.

Caller owns the returned pointer and is responsible for deleting it.

Parameters
requestRequest for which the Cancel will apply. ie. Invite request.
Returns
Created Cancel request. Caller must deallocate.

Definition at line 261 of file Helper.cxx.

◆ makeChallenge()

SipMessage * Helper::makeChallenge ( const SipMessage &  request,
const Data &  realm,
bool  useAuth = true,
bool  stale = false,
bool  proxy = false,
const std::vector< DigestType > &  digestTypes = std::vector<DigestType>() 
)
static

Definition at line 1224 of file Helper.cxx.

◆ makeChallengeResponseAuth() [1/2]

void Helper::makeChallengeResponseAuth ( const SipMessage &  request,
const Data &  username,
const Data &  password,
const Auth &  challenge,
const Data &  cnonce,
const Data &  authQop,
const Data &  nonceCountString,
Auth &  auth 
)
static

Definition at line 1434 of file Helper.cxx.

◆ makeChallengeResponseAuth() [2/2]

Auth Helper::makeChallengeResponseAuth ( const SipMessage &  request,
const Data &  username,
const Data &  password,
const Auth &  challenge,
const Data &  cnonce,
unsigned int &  nonceCount,
Data &  nonceCountString 
)
static

Definition at line 1415 of file Helper.cxx.

◆ makeChallengeResponseAuthWithA1() [1/2]

void Helper::makeChallengeResponseAuthWithA1 ( const SipMessage &  request,
const Data &  username,
const Data &  resipPasswordHashA1,
const Auth &  challenge,
const Data &  cnonce,
const Data &  authQop,
const Data &  nonceCountString,
Auth &  auth 
)
static

Definition at line 1525 of file Helper.cxx.

◆ makeChallengeResponseAuthWithA1() [2/2]

Auth Helper::makeChallengeResponseAuthWithA1 ( const SipMessage &  request,
const Data &  username,
const Data &  resipPasswordHashA1,
const Auth &  challenge,
const Data &  cnonce,
unsigned int &  nonceCount,
Data &  nonceCountString 
)
static

Definition at line 1506 of file Helper.cxx.

◆ makeFailureAck()

SipMessage * Helper::makeFailureAck ( const SipMessage &  request,
const SipMessage &  response 
)
static

This interface should be used by the stack (TransactionState) to create an AckMsg to a failure response.

See RFC3261 section 17.1.1.3. Caller owns the returned pointer and is responsible for deleting it.

Note
The branch in this ACK needs to be the one from the request. For TU generated ACK, see Dialog::makeAck(...)
Parameters
requestRequest that this ACK applies to.
responseResponse that we are ACKing - required so that we can get the To tag into the generated ACK.
Returns
Created Ack request. Caller must deallocate.

Definition at line 296 of file Helper.cxx.

◆ makeInvite() [1/2]

SipMessage * Helper::makeInvite ( const NameAddr &  target,
const NameAddr &  from 
)
static

Make an invite request - Empty Contact and Via is added and will be populated by the stack when sent.

Parameters
targetEnds up in the RequestURI and To header
fromEnds up in the From header

Definition at line 249 of file Helper.cxx.

◆ makeInvite() [2/2]

SipMessage * Helper::makeInvite ( const NameAddr &  target,
const NameAddr &  from,
const NameAddr &  contact 
)
static

Make an invite request using a overridden contact header - Empty Via is added and will be populated by the stack when sent.

Parameters
targetEnds up in the RequestURI and To header
fromEnds up in the From header
contactEnds up in the Contact header. Stack will not change this when sent.

Definition at line 255 of file Helper.cxx.

◆ makeMessage() [1/2]

SipMessage * Helper::makeMessage ( const NameAddr &  target,
const NameAddr &  from 
)
static

Create a Message request with an empty Contact. See makeRequest.

Definition at line 352 of file Helper.cxx.

◆ makeMessage() [2/2]

SipMessage * Helper::makeMessage ( const NameAddr &  target,
const NameAddr &  from,
const NameAddr &  contact 
)
static

Create a Message request with an overriden Contact. See makeRequest.

Definition at line 359 of file Helper.cxx.

◆ makeNonce()

Data Helper::makeNonce ( const SipMessage &  request,
const Data &  timestamp 
)
static

Definition at line 736 of file Helper.cxx.

◆ makeProxyChallenge()

SipMessage * Helper::makeProxyChallenge ( const SipMessage &  request,
const Data &  realm,
bool  useAuth = true,
bool  stale = false,
const std::vector< DigestType > &  digestTypes = std::vector<DigestType>() 
)
static

Definition at line 1212 of file Helper.cxx.

◆ makePublish() [1/2]

SipMessage * Helper::makePublish ( const NameAddr &  target,
const NameAddr &  from 
)
static

Create a Publish request with an empty Contact. See makeRequest.

Definition at line 322 of file Helper.cxx.

◆ makePublish() [2/2]

SipMessage * Helper::makePublish ( const NameAddr &  target,
const NameAddr &  from,
const NameAddr &  contact 
)
static

Create a Publish request with an overriden Contact. See makeRequest.

Definition at line 329 of file Helper.cxx.

◆ makeRawResponse()

void Helper::makeRawResponse ( Data &  rawBuffer,
const SipMessage &  request,
int  responseCode,
const Data &  additionalHeaders = Data::Empty,
const Data &  body = Data::Empty 
)
static

Definition at line 549 of file Helper.cxx.

◆ makeRegister() [1/4]

SipMessage * Helper::makeRegister ( const NameAddr &  to,
const Data &  transport 
)
static

Create a Register request with an empty Contact, transport is added to Request URI. See makeRequest.

Definition at line 210 of file Helper.cxx.

◆ makeRegister() [2/4]

SipMessage * Helper::makeRegister ( const NameAddr &  to,
const Data &  transport,
const NameAddr &  contact 
)
static

Create a Register request with an overriden Contact, transport is added to Request URI. See makeRequest.

Definition at line 218 of file Helper.cxx.

◆ makeRegister() [3/4]

SipMessage * Helper::makeRegister ( const NameAddr &  to,
const NameAddr &  from 
)
static

Create a Register request with an empty Contact. See makeRequest.

Definition at line 172 of file Helper.cxx.

◆ makeRegister() [4/4]

SipMessage * Helper::makeRegister ( const NameAddr &  to,
const NameAddr &  from,
const NameAddr &  contact 
)
static

Create a Register request with an overriden Contact. See makeRequest.

Definition at line 179 of file Helper.cxx.

◆ makeRequest() [1/2]

SipMessage * Helper::makeRequest ( const NameAddr &  target,
const NameAddr &  from,
const NameAddr &  contact,
MethodTypes  method 
)
static

///////////////////////////////////////////////////////////////////////////////////////////

SIP Message Helpers

/////////////////////////////////////////////////////////////////////////////////////////// Make a new request with a overridden Contact. To, maxforward=70, requestline created, cseq method set, cseq sequence is 1, from and from tag set, contact set, CallId created. Caller owns the returned pointer and is responsible for deleting it.

Note
While contact is only necessary for requests that establish a dialog, those are the requests most likely created by this method, others will be generated by the dialog.
Parameters
targetEnds up in the RequestURI and To header
fromEnds up in the From header
contactEnds up in the Contact header. Stack will not change this when sent.
methodType of request to create. Methos is used in the Request Line and the CSeq.
Returns
SipMessage request created. Caller must deallocate.

Definition at line 142 of file Helper.cxx.

◆ makeRequest() [2/2]

SipMessage * Helper::makeRequest ( const NameAddr &  target,
const NameAddr &  from,
MethodTypes  method 
)
static

Make a new request.

To, maxforward=70, requestline created, cseq method set, cseq sequence is 1, from and from tag set, CallId created. Caller owns the returned pointer and is responsible for deleting it.

Note
An empty contact header is added. This signals to the stack that it should be populated by the transports when sent.
Parameters
targetEnds up in the RequestURI and To header
fromEnds up in the From header
methodType of request to create. Methos is used in the Request Line and the CSeq.
Returns
SipMessage request created. Caller must deallocate.

Definition at line 165 of file Helper.cxx.

◆ makeResponse() [1/4]

SipMessage * Helper::makeResponse ( const SipMessage &  request,
int  responseCode,
const Data &  reason = Data::Empty,
const Data &  hostname = Data::Empty,
const Data &  warning = Data::Empty 
)
static

Make a new response to a provided request.

Adds a To tag, Contact and Record-Route headers appropriately. Caller owns the returned pointer and is responsible for deleting it.

Parameters
requestSipMessage request from which to generate the response
responseCodeResponse code to use on status line.
reasonOptional reason string to use on status line. If not provided then a default reason string will be added for well defined response codes.
hostnameOptional hostname to use in Warning header. Only used if warning is also provided.
warningOptional warning text. If present a Warning header is added and hostname is used in warning header
Returns
SipMessage populated with the appropriate response. Caller must deallocate.

Definition at line 512 of file Helper.cxx.

◆ makeResponse() [2/4]

SipMessage * Helper::makeResponse ( const SipMessage &  request,
int  responseCode,
const NameAddr &  myContact,
const Data &  reason = Data::Empty,
const Data &  hostname = Data::Empty,
const Data &  warning = Data::Empty 
)
static

Make a new response to a provided request with an overridden Contact.


Adds a To tag, Contact and Record-Route headers appropriately. Caller owns the returned pointer and is responsible for deleting it.

Parameters
requestSipMessage request from which to generate the response
responseCodeResponse code to use on status line.
myContactContact header to add to response.
reasonOptional reason string to use on status line. If not provided then a default reason string will be added for well defined response codes.
hostnameOptional hostname to use in Warning header. Only used if warning is also provided.
warningOptional warning text. If present a Warning header is added and hostname is used in warning header.
Returns
SipMessage populated with the appropriate response. Caller must deallocate.

Definition at line 527 of file Helper.cxx.

◆ makeResponse() [3/4]

void Helper::makeResponse ( SipMessage &  response,
const SipMessage &  request,
int  responseCode,
const Data &  reason = Data::Empty,
const Data &  hostname = Data::Empty,
const Data &  warning = Data::Empty 
)
static

Make a response to a provided request.

Adds a To tag, Contact and Record-Route headers appropriately.

Parameters
responseSipMessage populated with the appropriate response
requestSipMessage request from which to generate the response
responseCodeResponse code to use on status line.
reasonOptional reason string to use on status line. If not provided then a default reason string will be added for well defined response codes.
hostnameOptional hostname to use in Warning header. Only used if warning is also provided.
warningOptional warning text. If present a Warning header is added and hostname is used in warning header.

Definition at line 412 of file Helper.cxx.

◆ makeResponse() [4/4]

void Helper::makeResponse ( SipMessage &  response,
const SipMessage &  request,
int  responseCode,
const NameAddr &  myContact,
const Data &  reason = Data::Empty,
const Data &  hostname = Data::Empty,
const Data &  warning = Data::Empty 
)
static

Make a response to a provided request with an overridden Contact.


Adds a To tag, Contact and Record-Route headers appropriately.

Parameters
responseSipMessage populated with the appropriate response
requestSipMessage request from which to generate the response
responseCodeResponse code to use on status line.
myContactContact header to add to response.
reasonOptional reason string to use on status line. If not provided then a default reason string will be added for well defined response codes.
hostnameOptional hostname to use in Warning header. Only used if warning is also provided.
warningOptional warning text. If present a Warning header is added and hostname is used in warning header.

Definition at line 495 of file Helper.cxx.

◆ makeResponseDigest()

Data Helper::makeResponseDigest ( const Data &  username,
const Data &  password,
const Data &  realm,
const Data &  method,
const Data &  digestUri,
const Data &  nonce,
const Data &  qop = Data::Empty,
const Data &  cnonce = Data::Empty,
const Data &  cnonceCount = Data::Empty,
const Contents *  entityBody = 0,
DigestType  digestType = MD5 
)
static

Definition at line 1670 of file Helper.cxx.

◆ makeResponseDigestWithA1()

Data Helper::makeResponseDigestWithA1 ( const Data &  a1,
const Data &  method,
const Data &  digestUri,
const Data &  nonce,
const Data &  qop = Data::Empty,
const Data &  cnonce = Data::Empty,
const Data &  cnonceCount = Data::Empty,
const Contents *  entityBody = 0,
DigestType  digestType = MD5 
)
static

Definition at line 1593 of file Helper.cxx.

◆ makeResponseMD5()

static Data resip::Helper::makeResponseMD5 ( const Data &  username,
const Data &  password,
const Data &  realm,
const Data &  method,
const Data &  digestUri,
const Data &  nonce,
const Data &  qop = Data::Empty,
const Data &  cnonce = Data::Empty,
const Data &  cnonceCount = Data::Empty,
const Contents *  entityBody = 0 
)
inlinestatic

Definition at line 547 of file Helper.hxx.

◆ makeResponseMD5WithA1()

static Data resip::Helper::makeResponseMD5WithA1 ( const Data &  a1,
const Data &  method,
const Data &  digestUri,
const Data &  nonce,
const Data &  qop = Data::Empty,
const Data &  cnonce = Data::Empty,
const Data &  cnonceCount = Data::Empty,
const Contents *  entityBody = 0 
)
inlinestatic

Definition at line 532 of file Helper.hxx.

◆ makeSubscribe() [1/2]

SipMessage * Helper::makeSubscribe ( const NameAddr &  target,
const NameAddr &  from 
)
static

Create a Subscribe request with an empty Contact. See makeRequest.

Definition at line 382 of file Helper.cxx.

◆ makeSubscribe() [2/2]

SipMessage * Helper::makeSubscribe ( const NameAddr &  target,
const NameAddr &  from,
const NameAddr &  contact 
)
static

Create a Subscribe request with an overriden Contact. See makeRequest.

Definition at line 389 of file Helper.cxx.

◆ makeUri()

Uri Helper::makeUri ( const Data &  aor,
const Data &  scheme = Symbols::DefaultSipScheme 
)
static

///////////////////////////////////////////////////////////////////////////////////////////

Miscellaneous Helpers

///////////////////////////////////////////////////////////////////////////////////////////

Definition at line 1687 of file Helper.cxx.

◆ makeWWWChallenge()

SipMessage * Helper::makeWWWChallenge ( const SipMessage &  request,
const Data &  realm,
bool  useAuth = true,
bool  stale = false,
const std::vector< DigestType > &  digestTypes = std::vector<DigestType>() 
)
static

Definition at line 1218 of file Helper.cxx.

◆ massageRoute()

void Helper::massageRoute ( const SipMessage &  request,
NameAddr &  route 
)
static

Definition at line 1719 of file Helper.cxx.

◆ processStrictRoute()

void Helper::processStrictRoute ( SipMessage &  request)
static

Definition at line 1701 of file Helper.cxx.

◆ qopOption()

Data Helper::qopOption ( const Auth &  challenge)
static

Definition at line 1284 of file Helper.cxx.

◆ setNonceHelper()

void Helper::setNonceHelper ( NonceHelper *  nonceHelper)
static

///////////////////////////////////////////////////////////////////////////////////////////

Digest Authentication Helpers

/////////////////////////////////////////////////////////////////////////////////////////// Note: Helper assumes control of NonceHelper object and will delete when global scope is cleaned up

Definition at line 719 of file Helper.cxx.

◆ updateNonceCount()

void Helper::updateNonceCount ( unsigned int &  nonceCount,
Data &  nonceCountString 
)
static

Definition at line 1325 of file Helper.cxx.

◆ validateMessage()

bool Helper::validateMessage ( const SipMessage &  message,
resip::Data *  reason = 0 
)
static

Definition at line 1791 of file Helper.cxx.

Member Data Documentation

◆ tagSize

const int Helper::tagSize = 4
static

bytes in to-tag& from-tag, should prob. live somewhere else

Definition at line 42 of file Helper.hxx.


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