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 addMatchSrcSctpPort(MatchBuilder match, int portNum) { PortNumber port = new PortNumber(portNum); SctpMatchBuilder sctpMatch = new SctpMatchBuilder(); sctpMatch.setSctpSourcePort(port); match.setLayer4Match(sctpMatch.build()); }
private Set<SctpMatch> createSctpMatches(SctpMatch sctpMatch, Set<Long> sPorts, Set<Long> dPorts) { Set<SctpMatch> sctpMatches = new HashSet<>(); if (!sPorts.isEmpty() && dPorts.isEmpty()) { for (Long srcPort : sPorts) { equalOrNotSetValidation(sctpMatch.getSctpSourcePort(), srcPort.longValue()); sctpMatches .add(new SctpMatchBuilder(sctpMatch).setSctpSourcePort(new PortNumber(srcPort.intValue())).build()); } } else if (sPorts.isEmpty() && !dPorts.isEmpty()) { for (Long dstPort : dPorts) { equalOrNotSetValidation(sctpMatch.getSctpDestinationPort(), dstPort.longValue()); sctpMatches.add(new SctpMatchBuilder(sctpMatch) .setSctpDestinationPort(new PortNumber(dstPort.intValue())).build()); } } else if (!sPorts.isEmpty() && !dPorts.isEmpty()) { for (Long srcPort : sPorts) { for (Long dstPort : dPorts) { equalOrNotSetValidation(sctpMatch.getSctpSourcePort(), srcPort.longValue()); equalOrNotSetValidation(sctpMatch.getSctpDestinationPort(), dstPort.longValue()); sctpMatches .add(new SctpMatchBuilder(sctpMatch).setSctpSourcePort(new PortNumber(srcPort.intValue())) .setSctpDestinationPort(new PortNumber(dstPort.intValue())) .build()); } } } return sctpMatches; }
public static void addMatchDstSctpPort(MatchBuilder match, int portNum) { PortNumber port = new PortNumber(portNum); SctpMatchBuilder sctpMatch = new SctpMatchBuilder(); sctpMatch.setSctpDestinationPort(port); match.setLayer4Match(sctpMatch.build()); }
private static Layer4Match Layer4MatchAsSctp(final Match sourceMatch) { SctpMatchBuilder sctpMatchBuilder = new SctpMatchBuilder(); Integer sourcePort = transportPort(sourceMatch, MatchType.TP_SRC); Integer destinationPort = transportPort(sourceMatch, MatchType.TP_DST); if (sourcePort != null) { sctpMatchBuilder.setSctpSourcePort(new PortNumber(sourcePort)); } if (destinationPort != null) { sctpMatchBuilder.setSctpDestinationPort(new PortNumber( destinationPort)); } if(sourcePort != null || destinationPort != null) { return sctpMatchBuilder.build(); } return null; }
final SctpMatchBuilder sctpmatch = new SctpMatchBuilder(); final SctpMatchBuilder sctpmatch1 = new SctpMatchBuilder(); final PortNumber srcport = new PortNumber(1435); final PortNumber dstport = new PortNumber(22);
sctpMatch = new SctpMatchBuilder();
/** * @return */ private static MatchBuilder createL4SCTPMatch() { final MatchBuilder match = new MatchBuilder(); final EthernetMatchBuilder eth = new EthernetMatchBuilder(); final EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder(); ethTypeBuilder.setType(new EtherType(0x0800L)); eth.setEthernetType(ethTypeBuilder.build()); match.setEthernetMatch(eth.build()); final IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version ipmatch.setIpProtocol((short) 132); match.setIpMatch(ipmatch.build()); final SctpMatchBuilder sctpmatch = new SctpMatchBuilder(); final PortNumber srcport = new PortNumber(1435); final PortNumber dstport = new PortNumber(22); sctpmatch.setSctpSourcePort(srcport); sctpmatch.setSctpDestinationPort(dstport); match.setLayer4Match(sctpmatch.build()); return match; }
data.setTcpMatchBuilder(new TcpMatchBuilder()); data.setUdpMatchBuilder(new UdpMatchBuilder()); data.setSctpMatchBuilder(new SctpMatchBuilder()); data.setIcmpv4MatchBuilder(new Icmpv4MatchBuilder()); data.setIcmpv6MatchBuilder(new Icmpv6MatchBuilder());
} else if (SCTP_SHORT == protocol) { ipmatch.setIpProtocol(SCTP_SHORT); SctpMatchBuilder sctpMatchBuilder = new SctpMatchBuilder(); if (0 != srcPort) { sctpMatchBuilder.setSctpSourcePort(new PortNumber(srcPort));