Revision: 16260
Author: [email protected]
Date: Fri Jan 7 20:26:08 2011
Log: Some Java doc commenting
http://code.google.com/p/mobicents/source/detail?r=16260
Modified:
/trunk/protocols/ss7/sccp/sccp-api/src/main/java/org/mobicents/protocols/ss7/indicator/AddressIndicator.java
/trunk/protocols/ss7/sccp/sccp-api/src/main/java/org/mobicents/protocols/ss7/indicator/EncodingScheme.java
/trunk/protocols/ss7/sccp/sccp-api/src/main/java/org/mobicents/protocols/ss7/indicator/RoutingIndicator.java
=======================================
---
/trunk/protocols/ss7/sccp/sccp-api/src/main/java/org/mobicents/protocols/ss7/indicator/AddressIndicator.java
Tue Aug 24 06:39:15 2010
+++
/trunk/protocols/ss7/sccp/sccp-api/src/main/java/org/mobicents/protocols/ss7/indicator/AddressIndicator.java
Fri Jan 7 20:26:08 2011
@@ -18,69 +18,75 @@
package org.mobicents.protocols.ss7.indicator;
/**
- *
+ * The AI is the first field within Calling Party Address (CgPA) and Called
+ * Party Address (CdPA) and is one octet in length. Its function is to
indicate
+ * which information elements are present so that the address can be
interpreted
+ * in other words, it indicates the type of addressing information that is
to be
+ * found in the address field so the receiving node knows how to interpret
that
+ * data.
+ *
* @author kulikov
*/
public class AddressIndicator {
- //Global title indicator
+ // Global title indicator
private GlobalTitleIndicator globalTitleIndicator;
- //point code indicator
+ // point code indicator
private boolean pcPresent;
- //ssn indicator
+ // ssn indicator
private boolean ssnPresent;
- //routing indicator
+ // routing indicator
private RoutingIndicator routingIndicator;
-
- public AddressIndicator(boolean pcPresent, boolean ssnPresent,
RoutingIndicator rti, GlobalTitleIndicator gti) {
+
+ public AddressIndicator(boolean pcPresent, boolean ssnPresent,
+ RoutingIndicator rti, GlobalTitleIndicator gti) {
this.pcPresent = pcPresent;
this.ssnPresent = ssnPresent;
this.routingIndicator = rti;
this.globalTitleIndicator = gti;
}
-
+
public AddressIndicator(byte v) {
pcPresent = (v & 0x01) == 0x01;
ssnPresent = (v & 0x02) == 0x02;
globalTitleIndicator = GlobalTitleIndicator.valueOf((v >> 2) &
0x0f);
-
- routingIndicator = ((v >> 6) & 0x01) == 0x01 ?
- RoutingIndicator.ROUTING_BASED_ON_DPC_AND_SSN :
- RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE;
- }
-
+
+ routingIndicator = ((v >> 6) & 0x01) == 0x01 ?
RoutingIndicator.ROUTING_BASED_ON_DPC_AND_SSN
+ : RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE;
+ }
+
public GlobalTitleIndicator getGlobalTitleIndicator() {
return globalTitleIndicator;
}
-
+
public boolean pcPresent() {
return pcPresent;
}
-
+
public boolean ssnPresent() {
return ssnPresent;
}
-
+
public RoutingIndicator getRoutingIndicator() {
return routingIndicator;
}
-
+
public byte getValue() {
int b = 0;
-
+
if (pcPresent) {
b |= 0x01;
}
-
+
if (ssnPresent) {
b |= 0x02;
}
-
+
b |= (globalTitleIndicator.getValue() << 2);
-
+
if (routingIndicator ==
RoutingIndicator.ROUTING_BASED_ON_DPC_AND_SSN) {
b |= 0x40;
}
-
- return (byte)b;
+
+ return (byte) b;
}
}
=======================================
---
/trunk/protocols/ss7/sccp/sccp-api/src/main/java/org/mobicents/protocols/ss7/indicator/EncodingScheme.java
Tue Aug 24 06:39:15 2010
+++
/trunk/protocols/ss7/sccp/sccp-api/src/main/java/org/mobicents/protocols/ss7/indicator/EncodingScheme.java
Fri Jan 7 20:26:08 2011
@@ -22,73 +22,78 @@
import java.io.OutputStream;
/**
- *
+ * The Encoding Scheme (ES) tells the receiving node how to translate the
digits
+ * from binary code
+ *
* @author kulikov
*/
public enum EncodingScheme {
- UNKNOWN(0),
- BCD_ODD(1),
- BCD_EVEN(2);
-
+ UNKNOWN(0), BCD_ODD(1), BCD_EVEN(2);
+
private int value;
-
+
private EncodingScheme(int value) {
this.value = value;
}
-
+
public int getValue() {
return value;
}
-
+
public static EncodingScheme valueOf(int v) {
switch (v) {
- case 0 : return UNKNOWN;
- case 1 : return BCD_ODD;
- case 2 : return BCD_EVEN;
- default : return null;
+ case 0:
+ return UNKNOWN;
+ case 1:
+ return BCD_ODD;
+ case 2:
+ return BCD_EVEN;
+ default:
+ return null;
}
}
-
+
public String decodeDigits(InputStream in) throws IOException {
int b;
String digits = "";
-
+
while (in.available() > 0) {
- b = in.read() & 0xff;
- digits += Integer.toHexString(b & 0x0f) +
- Integer.toHexString((b & 0xf0) >> 4);
- }
-
+ b = in.read() & 0xff;
+ digits += Integer.toHexString(b & 0x0f)
+ + Integer.toHexString((b & 0xf0) >> 4);
+ }
+
if (value == 1) {
digits = digits.substring(0, digits.length() - 1);
}
-
+
return digits;
}
-
- public void encodeDigits(String digits, OutputStream out) throws
IOException {
+
+ public void encodeDigits(String digits, OutputStream out)
+ throws IOException {
boolean odd = digits.length() % 2 != 0;
int b = 0;
-
+
int count = odd ? digits.length() - 1 : digits.length();
-
- for (int i = 0; i < count - 1; i+= 2) {
+
+ for (int i = 0; i < count - 1; i += 2) {
String ds1 = digits.substring(i, i + 1);
String ds2 = digits.substring(i + 1, i + 2);
-
- int d1 = Integer.parseInt(ds1,16);
+
+ int d1 = Integer.parseInt(ds1, 16);
int d2 = Integer.parseInt(ds2, 16);
-
+
b = (byte) (d2 << 4 | d1);
out.write(b);
}
-
- //if number is odd append last digit with filler
+
+ // if number is odd append last digit with filler
if (odd) {
String ds1 = digits.substring(count, count + 1);
int d = Integer.parseInt(ds1);
-
- b = (byte)(d & 0x0f);
+
+ b = (byte) (d & 0x0f);
out.write(b);
}
}
=======================================
---
/trunk/protocols/ss7/sccp/sccp-api/src/main/java/org/mobicents/protocols/ss7/indicator/RoutingIndicator.java
Tue Aug 24 06:39:15 2010
+++
/trunk/protocols/ss7/sccp/sccp-api/src/main/java/org/mobicents/protocols/ss7/indicator/RoutingIndicator.java
Fri Jan 7 20:26:08 2011
@@ -18,10 +18,18 @@
package org.mobicents.protocols.ss7.indicator;
/**
- *
+ * The Routing Indicator (RI) specifies whether GTT is required; it
determines
+ * whether routing based on PC+SSN or GT. If routing is based on the GT,
the GT
+ * in the address is used for routing. If routing is based on PC+SSN, the
PC and
+ * SSN in the Called/Calling Party Address are used.
+ *
* @author kulikov
*/
public enum RoutingIndicator {
- ROUTING_BASED_ON_GLOBAL_TITLE,
- ROUTING_BASED_ON_DPC_AND_SSN;
-}
+
+ //Route on GT
+ ROUTING_BASED_ON_GLOBAL_TITLE,
+
+ //Route on PC + SSN
+ ROUTING_BASED_ON_DPC_AND_SSN;
+}