@Test public void testSwapSourceAndDestinationFields() { BDDPacket pkt = new BDDPacket(); BDDInteger dstIp = pkt.getDstIp(); BDDInteger srcIp = pkt.getSrcIp(); BDDInteger dstPort = pkt.getDstPort(); BDDInteger srcPort = pkt.getSrcPort(); Ip ip1 = Ip.parse("1.1.1.1"); Ip ip2 = Ip.parse("2.2.2.2"); Ip ip3 = Ip.parse("3.3.3.3"); Ip ip4 = Ip.parse("4.4.4.4"); BiFunction<BDDInteger, BDDInteger, Function<BDDInteger, BDD>> mkBdd = (ipVar1, ipVar2) -> portVar -> (ipVar1.value(ip1.asLong()).and(ipVar2.value(ip2.asLong())).and(portVar.value(0))) .or( ipVar1 .value(ip3.asLong()) .and(ipVar2.value(ip4.asLong())) .and(ipVar1.value(1))); BDD orig = mkBdd.apply(dstIp, srcIp).apply(dstPort); BDD swapped = mkBdd.apply(srcIp, dstIp).apply(srcPort); assertThat(pkt.swapSourceAndDestinationFields(orig), equalTo(swapped)); }
public BDD swapSourceAndDestinationFields(BDD bdd) { return bdd.replace(_swapSourceAndDestinationPairing); }
BDDPacket { public BDD swapSourceAndDestinationFields(BDD bdd) { return bdd.replace(_swapSourceAndDestinationPairing); } }
BDDPacket { public BDD swapSourceAndDestinationFields(BDD bdd) { return bdd.replace(_swapSourceAndDestinationPairing); } BDDPacket(); }
BDDPacket { public BDD swapSourceAndDestinationFields(BDD bdd) { return bdd.replace(_swapSourceAndDestinationPairing); } BDDPacket(); BDD allocateBDDBit(String name); BDDInteger allocateBDDInteger(String name, int bits, boolean reverse); IpSpaceToBDD getDstIpSpaceToBDD(); IpSpaceToBDD getSrcIpSpaceToBDD(); BDDFactory getFactory(); Optional<Flow.Builder> getFlow(BDD bdd, FlowPreference preference); Optional<Flow.Builder> getFlow(BDD bdd); Flow.Builder getRepresentativeFlow(BDD bdd); Flow.Builder getFromFromAssignment(BitSet bits); @Nonnull BDDInteger getDscp(); @Nonnull BDDInteger getDstIp(); @Nonnull BDDInteger getDstPort(); @Nonnull BDDInteger getEcn(); @Nonnull BDDInteger getFragmentOffset(); @Nonnull BDDIcmpCode getIcmpCode(); @Nonnull BDDIcmpType getIcmpType(); @Nonnull BDDIpProtocol getIpProtocol(); @Nonnull BDDPacketLength getPacketLength(); @Nonnull BDDInteger getSrcIp(); @Nonnull BDDInteger getSrcPort(); @Nonnull BDD getTcpAck(); @Nonnull BDD getTcpCwr(); @Nonnull BDD getTcpEce(); @Nonnull BDD getTcpFin(); @Nonnull BDD getTcpPsh(); @Nonnull BDD getTcpRst(); @Nonnull BDD getTcpSyn(); @Nonnull BDD getTcpUrg(); @Override int hashCode(); @Override boolean equals(Object o); BDD restrict(BDD bdd, Prefix pfx); BDD restrict(BDD bdd, List<Prefix> prefixes); BDD swapSourceAndDestinationFields(BDD bdd); }
BDDPacket { public BDD swapSourceAndDestinationFields(BDD bdd) { return bdd.replace(_swapSourceAndDestinationPairing); } BDDPacket(); BDD allocateBDDBit(String name); BDDInteger allocateBDDInteger(String name, int bits, boolean reverse); IpSpaceToBDD getDstIpSpaceToBDD(); IpSpaceToBDD getSrcIpSpaceToBDD(); BDDFactory getFactory(); Optional<Flow.Builder> getFlow(BDD bdd, FlowPreference preference); Optional<Flow.Builder> getFlow(BDD bdd); Flow.Builder getRepresentativeFlow(BDD bdd); Flow.Builder getFromFromAssignment(BitSet bits); @Nonnull BDDInteger getDscp(); @Nonnull BDDInteger getDstIp(); @Nonnull BDDInteger getDstPort(); @Nonnull BDDInteger getEcn(); @Nonnull BDDInteger getFragmentOffset(); @Nonnull BDDIcmpCode getIcmpCode(); @Nonnull BDDIcmpType getIcmpType(); @Nonnull BDDIpProtocol getIpProtocol(); @Nonnull BDDPacketLength getPacketLength(); @Nonnull BDDInteger getSrcIp(); @Nonnull BDDInteger getSrcPort(); @Nonnull BDD getTcpAck(); @Nonnull BDD getTcpCwr(); @Nonnull BDD getTcpEce(); @Nonnull BDD getTcpFin(); @Nonnull BDD getTcpPsh(); @Nonnull BDD getTcpRst(); @Nonnull BDD getTcpSyn(); @Nonnull BDD getTcpUrg(); @Override int hashCode(); @Override boolean equals(Object o); BDD restrict(BDD bdd, Prefix pfx); BDD restrict(BDD bdd, List<Prefix> prefixes); BDD swapSourceAndDestinationFields(BDD bdd); static final int FIRST_PACKET_VAR; }