1600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang/* 2600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * JBoss, Home of Professional Open Source 3600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * This code has been contributed to the public domain. 4600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * 5600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * This software is provided by NIST as a service and is expressly 6600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * provided "AS IS." NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED 7600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * OR STATUTORY, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF 8600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT 9600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * AND DATA ACCURACY. NIST does not warrant or make any representations 10600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * regarding the use of the software or the results thereof, including but 11600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * not limited to the correctness, accuracy, reliability or usefulness of 12600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * the software. 13600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * 14600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * Permission to use this software is contingent upon your acceptance 15600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * of the terms of this agreement. 16600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang */ 17600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wangpackage gov.nist.javax.sip; 18600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 19600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang/** 20600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * @author jean.deruelle@gmail.com 21600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * 22600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang */ 23600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wangpublic interface UtilsExt { 24600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 25600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang /** 26600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * Generate a call identifier. This is useful when we want to generate a 27600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * call identifier in advance of generating a message. 28600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * @since 2.0 29600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang */ 30600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang public String generateCallIdentifier(String address); 31600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 32600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang /** 33600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * Generate a tag for a FROM header or TO header. Just return a random 4 34600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * digit integer (should be enough to avoid any clashes!) Tags only need to 35600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * be unique within a call. 36600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * 37600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * @return a string that can be used as a tag parameter. 38600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * 39600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * synchronized: needed for access to 'rand', else risk to generate same tag 40600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * twice 41600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * @since 2.0 42600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang */ 43600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang public String generateTag(); 44600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang /** 45600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * Generate a cryptographically random identifier that can be used to 46600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * generate a branch identifier. 47600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * 48600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * @return a cryptographically random gloablly unique string that can be 49600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * used as a branch identifier. 50600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * @since 2.0 51600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang */ 52600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang public String generateBranchId(); 53600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 54600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 55600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang} 56