public PacketTraceOutput packettrace(FilterParameters fp) {
ConcurrentHashMap <String,String> filter = new ConcurrentHashMap<String,String> ();
String sid = null;
PacketTraceOutput output = new PacketTraceOutput();
IOFMessageFilterManagerService manager =
(IOFMessageFilterManagerService)getContext()
.getAttributes().
get(IOFMessageFilterManagerService.class.getCanonicalName());
if (manager == null) {
sid = null;
setStatus(Status.SERVER_ERROR_SERVICE_UNAVAILABLE);
}
if (fp.getSessionId() != null) {
filter.put("sessionId", fp.getSessionId());
}
if (fp.getMac() != null) {
filter.put("mac", fp.getMac());
}
if (fp.getDirection() != null) {
filter.put("direction", fp.getDirection());
}
if (filter.isEmpty()) {
setStatus(Status.CLIENT_ERROR_BAD_REQUEST);
} else {
if (log.isDebugEnabled()) {
log.debug ("Call setupFilter: sid:{} filter:{}, period:{}",
new Object[] {fp.getSessionId(), filter,
fp.getPeriod()*1000});
}
sid = manager.setupFilter(fp.getSessionId(), filter,
fp.getPeriod()*1000);
output.setSessionId(sid);
setStatus(Status.SUCCESS_OK);
}