FileDocCategorySizeDatePackage
SIPUtils.javaAPI DocphoneME MR2 API (J2ME)2343Wed May 02 18:00:42 BST 2007gov.nist.siplite

SIPUtils

public class SIPUtils extends Utils
SIP utility functions.

Fields Summary
private static int
counter
Seed for randomizer.
Constructors Summary
Methods Summary
public static java.lang.StringgenerateBranchId()
Generates the branch identifiers.

return
a branch identifier.

        String b =  new Long(System.currentTimeMillis()).toString() +
                new Random().nextLong();
        byte bid[] = digest(b.getBytes());

        // cryptographically random string.
        // prepend with a magic cookie to indicate we
        // are bis09 compatible.
        return SIPConstants.GENERAL_BRANCH_MAGIC_COOKIE +
            Utils.toHexString(bid);
    
public static java.lang.StringgenerateCallIdentifier(java.lang.String stackAddr)
Generates a call identifier for the stack.

param
stackAddr current stack address
return
a call id.

        String date = (new Date()).toString() + 
                       new Random(counter++).nextLong();
        byte cidbytes[] = digest(date.getBytes());
        String cidString = Utils.toHexString(cidbytes);
        return cidString + Separators.AT + stackAddr;