Class SccpAddressParser
- java.lang.Object
-
- SccpAddressParser
-
public class SccpAddressParser extends Object
Utility class for address parsing and encoding.
-
-
Constructor Summary
Constructors Constructor Description SccpAddressParser()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
encodeSccpAddress(SccpAddress address)
Obtain a string value for anSccpAddress
.static SccpAddress
parseSccpAddress(String addressString)
Parse an SCCP address string to return anSccpAddress
object initialised to the values specified by the string.static String
sccpNature(int nature)
Obtain a string value for an SCCP nature of address indicator.static byte
sccpNature(String nature)
Obtain a decimal value for an SCCP nature of address indicator.static String
sccpNumbering(int numbering)
Obtain a string value for an SCCP numbering plan.static byte
sccpNumbering(String numbering)
Obtain a decimal value for an SCCP numbering plan.
-
-
-
Method Detail
-
parseSccpAddress
public static SccpAddress parseSccpAddress(String addressString)
Parse an SCCP address string to return anSccpAddress
object initialised to the values specified by the string.The address string must be formatted as comma-seperated name/value pairs. The following parameters must be specified:
- type - SCCP address type. Valid values are "A7", "C7", "CH7", or "J7".
- ri - Routing indicator. Valid values are "gt", "pcssn", or "ssn". The values "pcssn" and "ssn" are equivalent.
The following additional parameters may be specified as required:
- pc - Point code. The value may be formatted either as a single decimal
value, as a '/' seperated triple or as a '-' separated triple. A single decimal
value must lie in the range 0-16777215 (= 0xffffff) which supports all addressing
formats up to 24-bits long expressed as a single number.
If
type=C7
has been specified, an x/y/z or x-y-z triple is taken to mean the 3/8/3 bit fields of the zone/area/signal point address format.If
type=A7
ortype=CH7
, an x/y/z triple is taken to mean the 8/8/8 bit fields of the member/cluster/network address format, and an x-y-z triple is taken to mean the 8/8/8 bit fields of the network-cluster-member address format. (Note the differing orders of the network, cluster and member fields between the x/y/z and x-y-z formats.) The integer value derived from the triple is in network byte order according to the order in which the ANSI SCCP specification states that the member, cluster and network components are transmitted: [00000000 MMMMMMMM CCCCCCCC NNNNNNNN]. It should be noted that this is the opposite order to that used by ANSI MTP. - ssn - Subsystem number. Valid values in the range 0-255.
- digits - Global title address digits.
- nature - Global title nature of address indicator. Valid values are "unknown", "international", "national", "subscriber", or a decimal value in the range 0-15.
- numbering - Global title number plan. Valid values are "unknown", "isdn", "generic", "data", "telex", "maritime-mobile", "land-mobile", "isdn-mobile", "private", or a decimal value in the range 0-15.
- tt - Global title translation type. Valid values in the range 0-255.
- national - Global title national indicator. Values values are "true" or "false".
- gti - Global Title Indicator. If omitted, this parameter will be calculated automatically. If present, this parameter will be validated against the expected value (based on the other parameters in the address) and an IllegalArgumentException will be thrown if it was specified incorrectly.
When specifying global titles, the following rules apply:
- Global title parameters are only included in the returned address if
digits
is specified. - For C7, J7, and CH7 SCCP addresses:
- if
nature
only is specified, a global title indicator of GT_0001 is used. - if
tt
only is specified, a global title indicator of GT_0010 is used. - if
numbering
andtt
are specified, a global title indicator of GT_0011 is used. - if
nature
and either or both ofnumbering
andtt
are specified, a global title indicator of GT_0100 is used. If unspecified, the number plan defaults to "unknown" and the translation type defaults to 0.
- if
- For A7 SCCP addresses:
- if
tt
only is specified, a global title indicator of GT_0010 is used. - if
tt
andnumbering
is specified, a global title indicator of GT_0001 is used.
- if
Example address strings:
-
type=c7,ri=pcssn,pc=4012,ssn=123
type=c7,ri=pcssn,pc=1/245/7,ssn=123
type=c7,ri=gt,digits=34607012345,nature=national,national=true- Parameters:
addressString
- the address string.- Returns:
- an SccpAddress initialised according to the properties specified.
- Throws:
IllegalArgumentException
- if an invalid option or value is specified.NullPointerException
- if addressString is null.
-
encodeSccpAddress
public static String encodeSccpAddress(SccpAddress address)
Obtain a string value for anSccpAddress
. The value returned from this method can be converted back into anSccpAddress
using theparseSccpAddress(java.lang.String)
method.- Parameters:
address
- the SCCP address.- Returns:
- a expression of the SCCP address in string form.
-
sccpNature
public static byte sccpNature(String nature)
Obtain a decimal value for an SCCP nature of address indicator.- Parameters:
nature
- the nature of address indicator expressed as a string value. Valid values are "unknown", "international", "national", "subscriber", or a decimal value in the range 0-15.- Returns:
- a byte value for the specified SCCP nature of address indicator.
- Throws:
IllegalArgumentException
- if an invalid value is specified.
-
sccpNature
public static String sccpNature(int nature)
Obtain a string value for an SCCP nature of address indicator. The value returned from this method can be converted back into integer form using thesccpNature(String)
method.- Parameters:
nature
- the nature of address indicator.- Returns:
- a string value for the nature of address. This value may be one of "unknown", "international", "national", or "subscriber" if the numbering plan is equal to one of these, otherwise the decimal value of the nature of address indicator as a string is returned.
-
sccpNumbering
public static byte sccpNumbering(String numbering)
Obtain a decimal value for an SCCP numbering plan.- Parameters:
numbering
- the numbering plan expressed as a string value. Valid values are "unknown", "isdn", "generic", "data", "telex", "maritime-mobile", "land-mobile", "isdn-mobile", "private", or a decimal value in the range 0-15.- Returns:
- a byte value for the specified SCCP numbering plan.
- Throws:
IllegalArgumentException
- if an invalid value is specified.
-
sccpNumbering
public static String sccpNumbering(int numbering)
Obtain a string value for an SCCP numbering plan. The value returned from this method can be converted back into integer form using thesccpNumbering(String)
method.- Parameters:
numbering
- the numbering plan.- Returns:
- a string value for the numbering plan. This value may be one of "unknown", "isdn", "generic", "data", "telex", "maritime-mobile", "land-mobile", "isdn-mobile", or "private" if the numbering plan is equal to one of these, otherwise the decimal value of the numbering plan as a string is returned.
-
-