NIST-SIP: The Reference Implementation for JAIN-SIP 1.2

gov.nist.javax.sip
Class Utils

java.lang.Object
  extended by gov.nist.javax.sip.Utils
All Implemented Interfaces:
UtilsExt

public class Utils
extends Object
implements UtilsExt

A few utilities that are used in various places by the stack. This is used to convert byte arrays to hex strings etc. Generate tags and branch identifiers and odds and ends.

Version:
1.2 $Revision: 1.20 $ $Date: 2009/08/19 17:47:47 $
Author:
mranga

Constructor Summary
Utils()
           
 
Method Summary
 String generateBranchId()
          Generate a cryptographically random identifier that can be used to generate a branch identifier.
 String generateCallIdentifier(String address)
          Generate a call identifier.
 String generateTag()
          Generate a tag for a FROM header or TO header.
static Utils getInstance()
           
static String getQuotedString(String str)
          Put quotes around a string and return it.
static String getSignature()
           
static void main(String[] args)
           
 boolean responseBelongsToUs(SIPResponse response)
           
static String toHexString(byte[] b)
          convert an array of bytes to an hexadecimal string
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Utils

public Utils()
Method Detail

getInstance

public static Utils getInstance()

toHexString

public static String toHexString(byte[] b)
convert an array of bytes to an hexadecimal string

Parameters:
b - bytes array to convert to a hexadecimal string
Returns:
a string

getQuotedString

public static String getQuotedString(String str)
Put quotes around a string and return it. Any " characters appearing in str are escaped

Parameters:
str - string to be quoted
Returns:
a quoted string

generateCallIdentifier

public String generateCallIdentifier(String address)
Generate a call identifier. This is useful when we want to generate a call identifier in advance of generating a message.

Specified by:
generateCallIdentifier in interface UtilsExt

generateTag

public String generateTag()
Generate a tag for a FROM header or TO header. Just return a random 4 digit integer (should be enough to avoid any clashes!) Tags only need to be unique within a call.

Specified by:
generateTag in interface UtilsExt
Returns:
a string that can be used as a tag parameter. synchronized: needed for access to 'rand', else risk to generate same tag twice

generateBranchId

public String generateBranchId()
Generate a cryptographically random identifier that can be used to generate a branch identifier.

Specified by:
generateBranchId in interface UtilsExt
Returns:
a cryptographically random gloablly unique string that can be used as a branch identifier.

responseBelongsToUs

public boolean responseBelongsToUs(SIPResponse response)

getSignature

public static String getSignature()

main

public static void main(String[] args)

NIST-SIP: The Reference Implementation for JAIN-SIP 1.2

A product of the NIST/ITL Advanced Networking Technologies Division.
See conditions of use.
Submit a bug report or feature request.