NIST SIP Parser and Stack (v1.2) API

gov.nist.javax.sip
Class Utils

java.lang.Object
  |
  +--gov.nist.javax.sip.Utils

public class Utils
extends Object

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.


Constructor Summary
Utils()
           
 
Method Summary
static String generateBranchId()
          Generate a cryptographically random identifier that can be used to generate a branch identifier.
static String generateCallIdentifier(String address)
          Generate a call identifier.
static String generateTag()
          Generate a tag for a FROM header or TO header.
static String getQuotedString(String str)
          Put quotes around a string and return it.
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

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.

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

generateCallIdentifier

public static 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.


generateTag

public static 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.

Returns:
a string that can be used as a tag parameter.

generateBranchId

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

Returns:
a cryptographically random gloablly unique string that can be used as a branch identifier.

NIST SIP Parser and Stack (v1.2) API

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