diff options
Diffstat (limited to 'framework/src/onos/utils/misc/src/main/java/org/onlab/packet/pim/PIMAddrGroup.java')
-rw-r--r-- | framework/src/onos/utils/misc/src/main/java/org/onlab/packet/pim/PIMAddrGroup.java | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/framework/src/onos/utils/misc/src/main/java/org/onlab/packet/pim/PIMAddrGroup.java b/framework/src/onos/utils/misc/src/main/java/org/onlab/packet/pim/PIMAddrGroup.java index be4ab19a..0db82afb 100644 --- a/framework/src/onos/utils/misc/src/main/java/org/onlab/packet/pim/PIMAddrGroup.java +++ b/framework/src/onos/utils/misc/src/main/java/org/onlab/packet/pim/PIMAddrGroup.java @@ -17,9 +17,11 @@ 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; @@ -41,7 +43,7 @@ public class PIMAddrGroup { * PIM Encoded Group Address. */ public PIMAddrGroup() { - this.family = 4; + this.family = PIM.ADDRESS_FAMILY_IP4; this.encType = 0; this.reserved = 0; this.bBit = false; @@ -83,7 +85,7 @@ public class PIMAddrGroup { public void setAddr(IpPrefix pfx) { this.addr = pfx.address(); this.masklen = (byte) pfx.prefixLength(); - this.family = (byte) ((this.addr.isIp4()) ? 4 : 6); + this.family = (byte) ((this.addr.isIp4()) ? PIM.ADDRESS_FAMILY_IP4 : PIM.ADDRESS_FAMILY_IP6); } /** @@ -181,9 +183,9 @@ public class PIMAddrGroup { checkInput(bb.array(), bb.position(), bb.limit() - bb.position(), ENC_GROUP_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_GROUP_IPV6_BYTE_LENGTH - 1); @@ -201,9 +203,9 @@ public class PIMAddrGroup { this.reserved |= 0x7d; 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; |