/** * Match by TCP. * @param match * @return the result of match. */ public boolean matchTcp(TcpMatch match) { return (match == null) || (match.getTcpSourcePort() == null && match.getTcpDestinationPort() == null); }
private static boolean convertL4TpDstMatch(final MatchV10Builder matchBuilder, final TcpMatch tcpMatch) { if (tcpMatch.getTcpDestinationPort() != null) { matchBuilder.setTpDst(tcpMatch.getTcpDestinationPort().getValue()); return false; } return true; }
public TcpMatchBuilder(TcpMatch base) { this._tcpDestinationPort = base.getTcpDestinationPort(); this._tcpSourcePort = base.getTcpSourcePort(); if (base instanceof TcpMatchImpl) { TcpMatchImpl _impl = (TcpMatchImpl) base; this.augmentation = new HashMap<>(_impl.augmentation); } }
if (other.getTcpDestinationPort() != null) { return false; } else if(!_tcpDestinationPort.equals(other.getTcpDestinationPort())) { return false;
private static void fillTransportLayer(Match target, TcpMatch source) { PortNumber tcpSourcePort = source.getTcpSourcePort(); if (tcpSourcePort != null) { Integer tcpSourcePortValue = tcpSourcePort.getValue(); if (tcpSourcePortValue != null) { target.setField(TP_SRC, tcpSourcePortValue.shortValue()); } } PortNumber tcpDestPort = source.getTcpDestinationPort(); if (tcpDestPort != null) { Integer tcpDestPortValue = tcpDestPort.getValue(); if (tcpDestPortValue != null) { target.setField(TP_DST, tcpDestPortValue.shortValue()); } } target.setField(NW_PROTO, TCP); }
private Set<TcpMatch> createTcpMatches(TcpMatch tcpMatch, Set<Long> sPorts, Set<Long> dPorts) { Set<TcpMatch> tcpMatches = new HashSet<>(); if (!sPorts.isEmpty() && dPorts.isEmpty()) { for (Long srcPort : sPorts) { equalOrNotSetValidation(tcpMatch.getTcpSourcePort(), srcPort.longValue()); tcpMatches .add(new TcpMatchBuilder(tcpMatch).setTcpSourcePort(new PortNumber(srcPort.intValue())).build()); } } else if (sPorts.isEmpty() && !dPorts.isEmpty()) { for (Long dstPort : dPorts) { equalOrNotSetValidation(tcpMatch.getTcpDestinationPort(), dstPort.longValue()); tcpMatches.add(new TcpMatchBuilder(tcpMatch).setTcpDestinationPort(new PortNumber(dstPort.intValue())) .build()); } } else if (!sPorts.isEmpty() && !dPorts.isEmpty()) { for (Long srcPort : sPorts) { for (Long dstPort : dPorts) { equalOrNotSetValidation(tcpMatch.getTcpSourcePort(), srcPort.longValue()); equalOrNotSetValidation(tcpMatch.getTcpDestinationPort(), dstPort.longValue()); tcpMatches.add(new TcpMatchBuilder(tcpMatch).setTcpSourcePort(new PortNumber(srcPort.intValue())) .setTcpDestinationPort(new PortNumber(dstPort.intValue())) .build()); } } } return tcpMatches; }
if (source.getTcpDestinationPort() != null) { MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder(); matchEntryBuilder.setOxmClass(OpenflowBasicClass.class); tcpDstBuilder.setPort(source.getTcpDestinationPort()); tcpDstCaseBuilder.setTcpDst(tcpDstBuilder.build()); matchEntryBuilder.setMatchEntryValue(tcpDstCaseBuilder.build());