com.ibm.twss.common.siputils
Class SipGrammar

java.lang.Object
  extended by com.ibm.twss.common.siputils.SipGrammar

public class SipGrammar
extends java.lang.Object

A collection of helper methods and regular expression definitions for working with RFC 3261 and related grammars. See RFC 3261 section 25 for details on the basic SIP grammar. Exposed regular expression String constants perform no capturing and are surrounded by a noncapturing group. This makes them ideal for re-use because they can be considered pure building blocks.

Version:
1.4

Field Summary
static java.util.regex.Pattern PATTERN_GENVALUE
          Compiled regex pattern to match an RFC 3261 gen-value rule
static java.util.regex.Pattern PATTERN_HOST
          Compiled regex pattern to match an RFC 3261 host rule
static java.util.regex.Pattern PATTERN_HOSTNAME
          Compiled regex pattern to match an RFC 3261 hostname rule
static java.util.regex.Pattern PATTERN_IPV4ADDRESS
          Compiled regex pattern to match an RFC 3261 IPv4address rule
static java.util.regex.Pattern PATTERN_IPV6ADDRESS
          Compiled regex pattern to match an RFC 3261 IPv6address rule
static java.util.regex.Pattern PATTERN_IPV6REFERENCE
          Compiled regex pattern to match an RFC 3261 IPv6reference rule
static java.util.regex.Pattern PATTERN_QUOTEDSTRING
          Compiled regex pattern to match an RFC 3261 quoted-string rule
static java.util.regex.Pattern PATTERN_TOKEN
          Compiled regex pattern to match an RFC 3261 token rule
static java.lang.String REGEX_DOMAINLABEL
          Regex to match RFC 3261's domainlabel rule.
static java.lang.String REGEX_EQUAL
          Regex to match RFC 3261's EQUAL rule
static java.lang.String REGEX_GENVALUE
          Regex to match RFC 3261's gen-value rule.
static java.lang.String REGEX_HEX4
          Regex to match RFC 3261's hex4 rule
static java.lang.String REGEX_HEXPART
          Regex to match RFC 3261's hexpart rule.
static java.lang.String REGEX_HEXSEQ
          Regex to match RFC 3261's hexseq rule
static java.lang.String REGEX_HOST
          Regex to match RFC 3261's host rule
static java.lang.String REGEX_HOSTNAME
          Regex to match RFC 3261's hostname rule
static java.lang.String REGEX_IPV4ADDRESS
          Regex to match RFC 3261's IPv4address rule
static java.lang.String REGEX_IPV6ADDRESS
          Regex to match RFC 3261's IPv6address rule
static java.lang.String REGEX_IPV6REFERENCE
          Regex to match RFC 3261's IPv6reference rule
static java.lang.String REGEX_QDTEXT
          Regex to match RFC 3261's qdtext rule
static java.lang.String REGEX_QUOTEDPAIR
          Regex to match RFC 3261's quoted-pair rule
static java.lang.String REGEX_QUOTEDSTRING
          Regex to match RFC 3261's quoted-string rule
static java.lang.String REGEX_SEMI
          Regex to match RFC 3261's SEMI Colon rule
static java.lang.String REGEX_TOKEN
          Regex to match RFC 3261's token rule
static java.lang.String REGEX_TOPLABEL
          Regex to match RFC 3261's toplabel rule.
 
Method Summary
static boolean isGenValue(java.lang.CharSequence charSeq)
          Checks if the entire character sequence is a 'gen-value' per RFC 3261's BNF on page 227.
static boolean isHost(java.lang.CharSequence charSeq)
          Checks if the entire character sequence is an 'host' per RFC 3261's BNF on page 222.
static boolean isHostname(java.lang.CharSequence charSeq)
          Checks if the entire character sequence is a 'hostname' per RFC 3261's BNF on page 222.
static boolean isIPv4Address(java.lang.CharSequence charSeq)
          Checks if the entire character sequence is an 'IPv4address' per RFC 3261's BNF on page 223.
static boolean isIPv6Address(java.lang.CharSequence charSeq)
          Checks if the entire character sequence is an 'IPv6address' per RFC 3261's BNF on page 223.
static boolean isIPv6Reference(java.lang.CharSequence charSeq)
          Checks if the entire character sequence is an 'IPv6address' per RFC 3261's BNF on page 223.
static boolean isQuotedString(java.lang.CharSequence charSeq)
          Checks if the entire character sequence is a 'quoted-string' per RFC 3261's BNF on page 222.
static boolean isToken(java.lang.CharSequence charSeq)
          Checks if the entire character sequence is a 'token' per RFC 3261's BNF on page 221.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REGEX_EQUAL

public static final java.lang.String REGEX_EQUAL
Regex to match RFC 3261's EQUAL rule

See Also:
Constant Field Values

REGEX_SEMI

public static final java.lang.String REGEX_SEMI
Regex to match RFC 3261's SEMI Colon rule

See Also:
Constant Field Values

REGEX_TOKEN

public static final java.lang.String REGEX_TOKEN
Regex to match RFC 3261's token rule

See Also:
Constant Field Values

PATTERN_TOKEN

public static final java.util.regex.Pattern PATTERN_TOKEN
Compiled regex pattern to match an RFC 3261 token rule


REGEX_DOMAINLABEL

public static final java.lang.String REGEX_DOMAINLABEL
Regex to match RFC 3261's domainlabel rule. The alternatives are reordered relative to the RFC to ensure that longer matches are attempted first.

See Also:
Constant Field Values

REGEX_TOPLABEL

public static final java.lang.String REGEX_TOPLABEL
Regex to match RFC 3261's toplabel rule. The alternatives are reordered relative to the RFC to ensure that longer matches are attempted first. Failing to put the trivial alternative last tends to make 'www.ibm.com' match as 'www.ibm.c' when used with the Matcher.find() method.

See Also:
Constant Field Values

REGEX_HOSTNAME

public static final java.lang.String REGEX_HOSTNAME
Regex to match RFC 3261's hostname rule

See Also:
Constant Field Values

PATTERN_HOSTNAME

public static final java.util.regex.Pattern PATTERN_HOSTNAME
Compiled regex pattern to match an RFC 3261 hostname rule


REGEX_IPV4ADDRESS

public static final java.lang.String REGEX_IPV4ADDRESS
Regex to match RFC 3261's IPv4address rule

See Also:
Constant Field Values

PATTERN_IPV4ADDRESS

public static final java.util.regex.Pattern PATTERN_IPV4ADDRESS
Compiled regex pattern to match an RFC 3261 IPv4address rule


REGEX_HEX4

public static final java.lang.String REGEX_HEX4
Regex to match RFC 3261's hex4 rule

See Also:
Constant Field Values

REGEX_HEXSEQ

public static final java.lang.String REGEX_HEXSEQ
Regex to match RFC 3261's hexseq rule

See Also:
Constant Field Values

REGEX_HEXPART

public static final java.lang.String REGEX_HEXPART
Regex to match RFC 3261's hexpart rule. The alternatives are reordered relative to the RFC to ensure that longer matches are attempted first.

See Also:
Constant Field Values

REGEX_IPV6ADDRESS

public static final java.lang.String REGEX_IPV6ADDRESS
Regex to match RFC 3261's IPv6address rule

See Also:
Constant Field Values

PATTERN_IPV6ADDRESS

public static final java.util.regex.Pattern PATTERN_IPV6ADDRESS
Compiled regex pattern to match an RFC 3261 IPv6address rule


REGEX_IPV6REFERENCE

public static final java.lang.String REGEX_IPV6REFERENCE
Regex to match RFC 3261's IPv6reference rule

See Also:
Constant Field Values

PATTERN_IPV6REFERENCE

public static final java.util.regex.Pattern PATTERN_IPV6REFERENCE
Compiled regex pattern to match an RFC 3261 IPv6reference rule


REGEX_HOST

public static final java.lang.String REGEX_HOST
Regex to match RFC 3261's host rule

See Also:
Constant Field Values

PATTERN_HOST

public static final java.util.regex.Pattern PATTERN_HOST
Compiled regex pattern to match an RFC 3261 host rule


REGEX_QUOTEDPAIR

public static final java.lang.String REGEX_QUOTEDPAIR
Regex to match RFC 3261's quoted-pair rule

See Also:
Constant Field Values

REGEX_QDTEXT

public static final java.lang.String REGEX_QDTEXT
Regex to match RFC 3261's qdtext rule

See Also:
Constant Field Values

REGEX_QUOTEDSTRING

public static final java.lang.String REGEX_QUOTEDSTRING
Regex to match RFC 3261's quoted-string rule

See Also:
Constant Field Values

PATTERN_QUOTEDSTRING

public static final java.util.regex.Pattern PATTERN_QUOTEDSTRING
Compiled regex pattern to match an RFC 3261 quoted-string rule


REGEX_GENVALUE

public static final java.lang.String REGEX_GENVALUE
Regex to match RFC 3261's gen-value rule. The alternatives are reordered relative to the RFC to ensure that longer matches are attempted first.

See Also:
Constant Field Values

PATTERN_GENVALUE

public static final java.util.regex.Pattern PATTERN_GENVALUE
Compiled regex pattern to match an RFC 3261 gen-value rule

Method Detail

isToken

public static boolean isToken(java.lang.CharSequence charSeq)
Checks if the entire character sequence is a 'token' per RFC 3261's BNF on page 221.

Parameters:
charSeq - to check.
Returns:
True if the character sequence is a valid token, false otherwise. Returns false on null input.

isHostname

public static boolean isHostname(java.lang.CharSequence charSeq)
Checks if the entire character sequence is a 'hostname' per RFC 3261's BNF on page 222.

Parameters:
charSeq - to check.
Returns:
True if the character sequence is a valid hostname, false otherwise. Returns false on null input.

isIPv4Address

public static boolean isIPv4Address(java.lang.CharSequence charSeq)
Checks if the entire character sequence is an 'IPv4address' per RFC 3261's BNF on page 223.

Parameters:
charSeq - to check.
Returns:
True if the character sequence is a valid IPv4address, false otherwise. Returns false on null input.

isIPv6Address

public static boolean isIPv6Address(java.lang.CharSequence charSeq)
Checks if the entire character sequence is an 'IPv6address' per RFC 3261's BNF on page 223.

Parameters:
charSeq - to check.
Returns:
True if the character sequence is a valid IPv6address, false otherwise. Returns false on null input.

isIPv6Reference

public static boolean isIPv6Reference(java.lang.CharSequence charSeq)
Checks if the entire character sequence is an 'IPv6address' per RFC 3261's BNF on page 223.

Parameters:
charSeq - to check.
Returns:
True if the character sequence is a valid IPv4reference, false otherwise. Returns false on null input.

isHost

public static boolean isHost(java.lang.CharSequence charSeq)
Checks if the entire character sequence is an 'host' per RFC 3261's BNF on page 222.

Parameters:
charSeq - to check.
Returns:
True if the character sequence is a valid host, false otherwise. Returns false on null input.

isQuotedString

public static boolean isQuotedString(java.lang.CharSequence charSeq)
Checks if the entire character sequence is a 'quoted-string' per RFC 3261's BNF on page 222.

Parameters:
charSeq - to check.
Returns:
True if the character sequence is a valid quoted-string, false otherwise. Returns false on null input.

isGenValue

public static boolean isGenValue(java.lang.CharSequence charSeq)
Checks if the entire character sequence is a 'gen-value' per RFC 3261's BNF on page 227.

Parameters:
charSeq - to check.
Returns:
True if the character sequence is a valid gen-value, false otherwise. Returns false on null input.


Copyright © 2003 IBM Corp. All Rights Reserved.