/** * Match by SCTP. * @param match * @return the result of match. */ public boolean matchSctp(SctpMatch match) { return (match == null) || (match.getSctpSourcePort() == null && match.getSctpDestinationPort() == null); }
/** * Match by UDP. * @param match * @return the result of match. */ public boolean mathcUdp(UdpMatch match) { return (match == null) || (match.getUdpSourcePort() == null && match.getUdpDestinationPort() == null); }
/** * 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 Layer4Match resolveL4Match(Map<String, ParameterValue> params) { Long ipProto = IpProtoClassifier.getIpProtoValue(params); if (ipProto == null) { throw new IllegalArgumentException("Parameter " + IpProtoClassifierDefinition.PROTO_PARAM + " is missing."); } if (IpProtoClassifierDefinition.UDP_VALUE.equals(ipProto)) { return new UdpMatchBuilder().build(); } else if (IpProtoClassifierDefinition.TCP_VALUE.equals(ipProto)) { return new TcpMatchBuilder().build(); } else if (IpProtoClassifierDefinition.SCTP_VALUE.equals(ipProto)) { return new SctpMatchBuilder().build(); } throw new IllegalArgumentException("Parameter " + IpProtoClassifierDefinition.PROTO_PARAM + ": value " + ipProto + " is " + Classifier.MSG_NOT_SUPPORTED); }
public static void addMatchDstTcpPort(MatchBuilder match, int portNum) { PortNumber port = new PortNumber(portNum); TcpMatchBuilder tcpMatch = new TcpMatchBuilder(); tcpMatch.setTcpDestinationPort(port); match.setLayer4Match(tcpMatch.build()); }
public static void addMatchDstUdpPort(MatchBuilder match, int portNum) { PortNumber port = new PortNumber(portNum); UdpMatchBuilder udpMatch = new UdpMatchBuilder(); udpMatch.setUdpDestinationPort(port); match.setLayer4Match(udpMatch.build()); }
public static void addMatchSrcUdpPort(MatchBuilder match, int portNum) { PortNumber port = new PortNumber(portNum); UdpMatchBuilder udpMatch = new UdpMatchBuilder(); udpMatch.setUdpSourcePort(port); match.setLayer4Match(udpMatch.build()); }
public static void addMatchSrcTcpPort(MatchBuilder match, int portNum) { PortNumber port = new PortNumber(portNum); TcpMatchBuilder tcpMatch = new TcpMatchBuilder(); tcpMatch.setTcpSourcePort(port); match.setLayer4Match(tcpMatch.build()); }
public static void addMatchDstSctpPort(MatchBuilder match, int portNum) { PortNumber port = new PortNumber(portNum); SctpMatchBuilder sctpMatch = new SctpMatchBuilder(); sctpMatch.setSctpDestinationPort(port); match.setLayer4Match(sctpMatch.build()); }
/** * Create an {@link TcpMatchBuilder} instance. * * @param tmatch An {@link TcpMatchBuilder} instance. * {@code null} must be specified on the first call. * @return If {@code tmatch} is {@code null}, this method creates a new * {@link TcpMatchBuilder} instance and returns it. * Otherwise a {@link TcpMatchBuilder} instance passed to * {@code tmatch} is returned. */ private TcpMatchBuilder create(TcpMatchBuilder tmatch) { return (tmatch == null) ? new TcpMatchBuilder() : tmatch; }
/** * Create an {@link UdpMatchBuilder} instance. * * @param umatch An {@link UdpMatchBuilder} instance. * {@code null} must be specified on the first call. * @return If {@code umatch} is {@code null}, this method creates a new * {@link UdpMatchBuilder} instance and returns it. * Otherwise a {@link UdpMatchBuilder} instance passed to * {@code umatch} is returned. */ private UdpMatchBuilder create(UdpMatchBuilder umatch) { return (umatch == null) ? new UdpMatchBuilder() : umatch; }
private static boolean convertL4UdpDstMatch(final MatchV10Builder matchBuilder, final UdpMatch udpMatch) { if (udpMatch.getUdpDestinationPort() != null) { matchBuilder.setTpDst(udpMatch.getUdpDestinationPort().getValue()); return false; } return true; }
private static boolean convertL4UdpSrcMatch(final MatchV10Builder matchBuilder, final UdpMatch udpMatch) { if (udpMatch.getUdpSourcePort() != null) { matchBuilder.setTpSrc(udpMatch.getUdpSourcePort().getValue()); return false; } return true; }
private static boolean convertL4TpDstMatch(final MatchV10Builder matchBuilder, final TcpMatch tcpMatch) { if (tcpMatch.getTcpDestinationPort() != null) { matchBuilder.setTpDst(tcpMatch.getTcpDestinationPort().getValue()); return false; } return true; }
public UdpMatch build() { return new UdpMatchImpl(this); }
public TcpMatch build() { return new TcpMatchImpl(this); }
public SctpMatch build() { return new SctpMatchImpl(this); }
public SctpMatchBuilder(SctpMatch base) { this._sctpDestinationPort = base.getSctpDestinationPort(); this._sctpSourcePort = base.getSctpSourcePort(); if (base instanceof SctpMatchImpl) { SctpMatchImpl _impl = (SctpMatchImpl) base; this.augmentation = new HashMap<>(_impl.augmentation); } }
public UdpMatchBuilder(UdpMatch base) { this._udpDestinationPort = base.getUdpDestinationPort(); this._udpSourcePort = base.getUdpSourcePort(); if (base instanceof UdpMatchImpl) { UdpMatchImpl _impl = (UdpMatchImpl) base; this.augmentation = new HashMap<>(_impl.augmentation); } }
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); } }