/** * Returns the IPv6 address value of the prefix. * * @return the IPv6 address value of the prefix */ public Ip6Address address() { IpAddress a = super.address(); return (Ip6Address) a; }
/** * Returns the IPv4 address value of the prefix. * * @return the IPv4 address value of the prefix */ public Ip4Address address() { IpAddress a = super.address(); return (Ip4Address) a; }
/** * PIM Encoded Source Address. * * @param spfx IPv4 or IPv6 address prefix */ public void setAddr(IpPrefix spfx) { this.addr = spfx.address(); this.masklen = (byte) spfx.prefixLength(); this.family = (byte) ((this.addr.isIp4()) ? PIM.ADDRESS_FAMILY_IP4 : PIM.ADDRESS_FAMILY_IP6); }
/** * Set the encoded source address. * * @param pfx address prefix */ public void setAddr(IpPrefix pfx) { this.addr = pfx.address(); this.masklen = (byte) pfx.prefixLength(); this.family = (byte) ((this.addr.isIp4()) ? PIM.ADDRESS_FAMILY_IP4 : PIM.ADDRESS_FAMILY_IP6); }
@Override public void write(Kryo kryo, Output output, IpPrefix object) { byte[] octs = object.address().toOctets(); output.writeInt(octs.length); output.writeBytes(octs); output.writeInt(object.prefixLength()); }
@Override public void init(Criterion criterion, int bitWidth) throws ByteSequenceTrimException { IPCriterion c = (IPCriterion) criterion; initAsLpm(copyFrom(c.ip().address().toOctets()), c.ip().prefixLength(), bitWidth); } }
@Override public int compareTo(Object o) { if (this.equals(o)) { return 0; } if (o instanceof BgpFsDestinationPrefix) { BgpFsDestinationPrefix that = (BgpFsDestinationPrefix) o; if (this.ipPrefix().prefixLength() == that.ipPrefix().prefixLength()) { ByteBuffer value1 = ByteBuffer.wrap(this.ipPrefix.address().toOctets()); ByteBuffer value2 = ByteBuffer.wrap(that.ipPrefix.address().toOctets()); return value1.compareTo(value2); } if (this.ipPrefix().prefixLength() > that.ipPrefix().prefixLength()) { return 1; } else if (this.ipPrefix().prefixLength() < that.ipPrefix().prefixLength()) { return -1; } } return 1; }
@Override public int compareTo(Object o) { if (this.equals(o)) { return 0; } if (o instanceof BgpFsSourcePrefix) { BgpFsSourcePrefix that = (BgpFsSourcePrefix) o; if (this.ipPrefix().prefixLength() == that.ipPrefix().prefixLength()) { ByteBuffer value1 = ByteBuffer.wrap(this.ipPrefix.address().toOctets()); ByteBuffer value2 = ByteBuffer.wrap(that.ipPrefix.address().toOctets()); return value1.compareTo(value2); } if (this.ipPrefix().prefixLength() > that.ipPrefix().prefixLength()) { return 1; } else if (this.ipPrefix().prefixLength() < that.ipPrefix().prefixLength()) { return -1; } } return 1; }
IpPrefix ipPrefix = ipCriterion.ip(); if (ipPrefix.address().equals(IpAddress.valueOf(USERDATA_IP))) { forTable = CLASSIFIER_TABLE; transition = MAC_TABLE;