summaryrefslogtreecommitdiffstats
path: root/framework/src/onos/utils/misc/src/main/java/org/onlab/packet/pim/PIMAddrSource.java
diff options
context:
space:
mode:
authorAshlee Young <ashlee@onosfw.com>2015-10-23 08:31:31 -0700
committerAshlee Young <ashlee@onosfw.com>2015-10-23 08:31:31 -0700
commite52e67767076b29cb01939aa7bdd8fee9d205cc1 (patch)
treeb8c2d28231bccc2a280fea429a9af7297c62f58f /framework/src/onos/utils/misc/src/main/java/org/onlab/packet/pim/PIMAddrSource.java
parenta912c5ce9968da5936a695064f22083898e7b93d (diff)
Update ONOS src to commit id 69b36d5d11e81e28e56b46ba44e4b8cd701c5867
Change-Id: I9c13045711dbf9c0181106b66a6bf22c72bcf330 Signed-off-by: Ashlee Young <ashlee@onosfw.com>
Diffstat (limited to 'framework/src/onos/utils/misc/src/main/java/org/onlab/packet/pim/PIMAddrSource.java')
-rw-r--r--framework/src/onos/utils/misc/src/main/java/org/onlab/packet/pim/PIMAddrSource.java17
1 files changed, 9 insertions, 8 deletions
diff --git a/framework/src/onos/utils/misc/src/main/java/org/onlab/packet/pim/PIMAddrSource.java b/framework/src/onos/utils/misc/src/main/java/org/onlab/packet/pim/PIMAddrSource.java
index 21526408..762dad56 100644
--- a/framework/src/onos/utils/misc/src/main/java/org/onlab/packet/pim/PIMAddrSource.java
+++ b/framework/src/onos/utils/misc/src/main/java/org/onlab/packet/pim/PIMAddrSource.java
@@ -17,9 +17,10 @@ package org.onlab.packet.pim;
import org.onlab.packet.DeserializationException;
import org.onlab.packet.Ip4Address;
+import org.onlab.packet.Ip6Address;
import org.onlab.packet.IpAddress;
import org.onlab.packet.IpPrefix;
-import org.onlab.packet.Ip6Address;
+import org.onlab.packet.PIM;
import java.nio.ByteBuffer;
@@ -66,7 +67,7 @@ public class PIMAddrSource {
}
private void init() {
- this.family = 4;
+ this.family = PIM.ADDRESS_FAMILY_IP4;
this.encType = 0;
this.reserved = 0;
this.sBit = true;
@@ -92,7 +93,7 @@ public class PIMAddrSource {
public void setAddr(IpPrefix spfx) {
this.addr = spfx.address();
this.masklen = (byte) spfx.prefixLength();
- this.family = (byte) ((this.addr.isIp4()) ? 4 : 6);
+ this.family = (byte) ((this.addr.isIp4()) ? PIM.ADDRESS_FAMILY_IP4 : PIM.ADDRESS_FAMILY_IP6);
}
/**
@@ -156,7 +157,7 @@ public class PIMAddrSource {
*/
public int getByteSize() {
int size = 4;
- size += addr.isIp4() ? 4 : 16;
+ size += addr.isIp4() ? PIM.ADDRESS_FAMILY_IP4 : PIM.ADDRESS_FAMILY_IP6;
return size;
}
@@ -202,9 +203,9 @@ public class PIMAddrSource {
checkInput(bb.array(), bb.position(), bb.limit() - bb.position(), ENC_SOURCE_IPV4_BYTE_LENGTH);
this.family = bb.get();
- if (family != 4 && family != 6) {
+ if (family != PIM.ADDRESS_FAMILY_IP4 && family != PIM.ADDRESS_FAMILY_IP6) {
throw new DeserializationException("Illegal IP version number: " + family + "\n");
- } else if (family == 6) {
+ } else if (family == PIM.ADDRESS_FAMILY_IP6) {
// Check for one less by since we have already read the first byte of the packet.
checkInput(bb.array(), bb.position(), bb.limit() - bb.position(), ENC_SOURCE_IPV6_BYTE_LENGTH - 1);
@@ -226,9 +227,9 @@ public class PIMAddrSource {
this.reserved &= 0xf8;
this.masklen = bb.get();
- if (this.family == 4) {
+ if (this.family == PIM.ADDRESS_FAMILY_IP4) {
this.addr = IpAddress.valueOf(bb.getInt());
- } else if (this.family == 6) {
+ } else if (this.family == PIM.ADDRESS_FAMILY_IP6) {
this.addr = Ip6Address.valueOf(bb.array(), 2);
}
return this;