@Test public void test_tcpFlags() { TcpFlagsMatchConditions flags1 = TcpFlagsMatchConditions.builder() .setUseAck(true) .setUseEce(true) .setTcpFlags(TcpFlags.builder().setAck(true).setEce(false).build()) .build(); TcpFlagsMatchConditions flags2 = TcpFlagsMatchConditions.builder() .setUseCwr(true) .setUseFin(true) .setTcpFlags(TcpFlags.builder().setCwr(true).setFin(false).build()) .build(); HeaderSpace headerSpace = HeaderSpace.builder().setTcpFlags(ImmutableList.of(flags1, flags2)).build(); BDD bdd = _toBDD.toBDD(headerSpace); BDD tcpFlagsBDD = _pkt.getTcpAck() .and(_pkt.getTcpEce().not()) .or(_pkt.getTcpCwr().and(_pkt.getTcpFin().not())); assertThat(bdd, equalTo(tcpFlagsBDD)); }
@Nullable private BDD toBDD(Collection<Integer> ints, BDDInteger var) { if (ints == null || ints.isEmpty()) { return null; } return _bddOps.or(ints.stream().map(var::value).collect(Collectors.toList())); }
HeaderSpaceToBDD { @Nullable private BDD toBDD(Collection<Integer> ints, BDDInteger var) { if (ints == null || ints.isEmpty()) { return null; } return _bddOps.or(ints.stream().map(var::value).collect(Collectors.toList())); } }
HeaderSpaceToBDD { @Nullable private BDD toBDD(Collection<Integer> ints, BDDInteger var) { if (ints == null || ints.isEmpty()) { return null; } return _bddOps.or(ints.stream().map(var::value).collect(Collectors.toList())); } HeaderSpaceToBDD(BDDPacket bddPacket, Map<String, IpSpace> namedIpSpaces); }
HeaderSpaceToBDD { @Nullable private BDD toBDD(Collection<Integer> ints, BDDInteger var) { if (ints == null || ints.isEmpty()) { return null; } return _bddOps.or(ints.stream().map(var::value).collect(Collectors.toList())); } HeaderSpaceToBDD(BDDPacket bddPacket, Map<String, IpSpace> namedIpSpaces); IpSpaceToBDD getDstIpSpaceToBdd(); IpSpaceToBDD getSrcIpSpaceToBdd(); BDD toBDD(HeaderSpace headerSpace); }
HeaderSpaceToBDD { @Nullable private BDD toBDD(Collection<Integer> ints, BDDInteger var) { if (ints == null || ints.isEmpty()) { return null; } return _bddOps.or(ints.stream().map(var::value).collect(Collectors.toList())); } HeaderSpaceToBDD(BDDPacket bddPacket, Map<String, IpSpace> namedIpSpaces); IpSpaceToBDD getDstIpSpaceToBdd(); IpSpaceToBDD getSrcIpSpaceToBdd(); BDD toBDD(HeaderSpace headerSpace);  }