/*
* Copyright (C) 2010 Alexander Kolosov
*
* This file is part of FlowBrook.
*
* FlowBrook is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* FlowBrook is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with FlowBrook. If not, see <http://www.gnu.org/licenses/>
*/
package ru.petrsu.akolosov.flowbrook.processing;
import java.util.Set;
import ru.petrsu.akolosov.flowbrook.processing.filters.AndFilter;
import ru.petrsu.akolosov.flowbrook.processing.filters.FlowFilter;
import ru.petrsu.akolosov.flowbrook.processing.filters.PortFilter;
/**
*
* @author Alexander Kolosov
*/
public final class IpDirectionsRule extends FlowDataProcessingRule {
private final Set<Integer> ports;
public IpDirectionsRule(FlowFilter filter, FlowProcessingResultHandler resultHandler, Set<Integer> ports) {
super(null, resultHandler);
this.ports = ports;
AndFilter resFilter = new AndFilter();
resFilter.addFilter(filter);
resFilter.addFilter(PortFilter.createMultiplePortFilter(ports, EndPoint.Both));
setFilter(resFilter);
}
Set<Integer> getPorts() {
return ports;
}
@Override
public FlowRecordHandler getRecordHandlerInstance() {
return new IpDirectionsRecordHandler(this);
}
}