Methods Summary |
---|
private void | checkValue(java.lang.String cid)Checks Call-Id value validity
// RFC 3261 p.228
// Call-ID = ( "Call-ID" / "i" ) HCOLON callid
// callid = word [ "@" word ]
// word = 1*(alphanum / "-" / "." / "!" / "%" / "*" /
// "_" / "+" / "`" / "'" / "~" /
// "(" / ")" / "<" / ">" /
// ":" / "\" / DQUOTE /
// "/" / "[" / "]" / "?" /
// "{" / "}" )
// The word construct is used in
// Call-ID to allow most separators to be used.
String word = "-.!%*_+`'~()<>:\\\"/[]?{}";
char c;
for (int i = 0; i < cid.length(); i++) {
c = cid.charAt(i);
if (Lexer.isAlpha(c) || Lexer.isHexDigit(c) ||
word.indexOf(c) != -1) {
continue;
}
throw new IllegalArgumentException("Wrong Call-Id value:"
+ "illegal use of symbol '"
+c+"' at '"+cid+"'");
}
|
public java.lang.Object | clone()Clone - do a deep copy.
CallIdentifier retval = new CallIdentifier();
if (this.localId != null) retval.localId = new String(this.localId);
if (this.host != null) retval.host = new String(this.host);
return retval;
|
public java.lang.String | encode()Get the encoded version of this id.
if (host != null) {
return localId + Separators.AT + host;
} else {
return localId;
}
|
public boolean | equals(java.lang.Object other)Compare two call identifiers for equality.
if (! other.getClass().equals(this.getClass())) {
return false;
}
CallIdentifier that = (CallIdentifier) other;
if (this.localId.compareTo(that.localId) != 0) {
return false;
}
if (this.host == that.host)
return true;
if ((this.host == null && that.host != null) ||
(this.host != null && that.host == null)) return false;
if (Utils.compareToIgnoreCase(host, that.host) != 0) {
return false;
}
return true;
|
public java.lang.String | getHost()get the host field
return host;
|
public java.lang.String | getLocalId()get the LocalId field
return localId;
|
public void | setCallIdHeader(java.lang.String cid)set the callId field
if (cid == null)
throw new IllegalArgumentException("NULL!");
int index = cid.indexOf('@");
if (index == -1) {
checkValue(cid);
localId = cid;
host = null;
} else {
if (index == 0 || index == cid.length()-1) {
throw new IllegalArgumentException
("CallIdHeader must be token@token or token");
}
String temp1 = cid.substring(0, index);
String temp2 = cid.substring(index+1, cid.length());
checkValue(temp1);
checkValue(temp2);
localId = temp1;
host = temp2;
}
|
public void | setHost(java.lang.String host)Set the host member
this.host = host;
|
public void | setLocalId(java.lang.String localId)Set the localId member
this.localId = localId;
|
public java.lang.String | toString()Encodes the object. Calls encode().
return encode();
|