use of com.att.aro.core.packetanalysis.pojo.ApplicationPacketSummary in project VideoOptimzer by attdevsupport.
the class EndPointSummaryPanel method getTable.
/**
* Returns a DataTable containing the end point summary per application data.
*
* @return A DataTable object containing the end point summary per application data.
*/
public DataTable<ApplicationPacketSummary> getTable() {
if (table == null) {
table = new DataTable<ApplicationPacketSummary>(tableModel);
table.setName(ResourceBundleHelper.getMessageString("statistics.application.summary.tableName"));
table.setAutoCreateRowSorter(true);
DataTablePopupMenu popupMenu = (DataTablePopupMenu) table.getPopup();
popupMenu.initialize();
}
return table;
}
use of com.att.aro.core.packetanalysis.pojo.ApplicationPacketSummary in project VideoOptimzer by attdevsupport.
the class PacketAnalyzerImpl method getStatistic.
@Override
public Statistic getStatistic(List<PacketInfo> packetInfos) {
Statistic stat = new Statistic();
Set<String> appNames = new HashSet<String>();
if (!packetInfos.isEmpty() && packetInfos.size() > 0) {
long totalHTTPSBytes = 0;
long totalBytes = 0;
long totalTCPBytes = 0;
long totalPayloadBytes = 0;
long totalTCPPayloadBytes = 0;
int totalTCPPackets = 0;
double minTCPPacketTimestamp = Double.MAX_VALUE;
double maxTCPPacketTimestamp = Double.MIN_VALUE;
List<IPPacketSummary> ipPacketSummary = new ArrayList<>();
List<ApplicationPacketSummary> applicationPacketSummary = new ArrayList<>();
Map<Integer, Integer> packetSizeToCountMap = new HashMap<>();
Map<String, PacketCounter> appPackets = new HashMap<>();
Map<InetAddress, PacketCounter> ipPackets = new HashMap<>();
for (PacketInfo packetInfo : packetInfos) {
if (packetInfo != null) {
totalBytes += packetInfo.getLen();
totalPayloadBytes += packetInfo.getPacket().getPayloadLen();
PacketCounter pCounter;
if (packetInfo.getPacket() instanceof TCPPacket) {
++totalTCPPackets;
minTCPPacketTimestamp = Math.min(minTCPPacketTimestamp, packetInfo.getTimeStamp());
maxTCPPacketTimestamp = Math.max(maxTCPPacketTimestamp, packetInfo.getTimeStamp());
TCPPacket tcp = (TCPPacket) packetInfo.getPacket();
totalTCPBytes += tcp.getPacketLength();
totalTCPPayloadBytes += tcp.getPayloadLen();
if (tcp.isSsl() || tcp.getDestinationPort() == 443 || tcp.getSourcePort() == 443) {
totalHTTPSBytes += tcp.getPayloadLen();
}
}
if (packetInfo.getPacket() instanceof IPPacket) {
// Count packets by packet size
Integer packetSize = packetInfo.getPacket().getPayloadLen();
Integer iValue = packetSizeToCountMap.get(packetSize);
if (iValue == null) {
iValue = 1;
} else {
iValue++;
}
packetSizeToCountMap.put(packetSize, iValue);
// Get IP address summary
InetAddress ipAddress = packetInfo.getRemoteIPAddress();
pCounter = ipPackets.get(ipAddress);
if (pCounter == null) {
pCounter = new PacketCounter();
ipPackets.put(ipAddress, pCounter);
}
pCounter.add(packetInfo);
}
String appName = packetInfo.getAppName();
appNames.add(appName);
pCounter = appPackets.get(appName);
if (pCounter == null) {
pCounter = new PacketCounter();
appPackets.put(appName, pCounter);
}
pCounter.add(packetInfo);
}
}
for (Map.Entry<InetAddress, PacketCounter> ipPacketMap : ipPackets.entrySet()) {
ipPacketSummary.add(new IPPacketSummary(ipPacketMap.getKey(), ipPacketMap.getValue().getPacketCount(), ipPacketMap.getValue().getTotalBytes(), ipPacketMap.getValue().getTotalPayloadBytes()));
}
for (Map.Entry<String, PacketCounter> appPacketMap : appPackets.entrySet()) {
applicationPacketSummary.add(new ApplicationPacketSummary(appPacketMap.getKey(), appPacketMap.getValue().getPacketCount(), appPacketMap.getValue().getTotalBytes(), appPacketMap.getValue().getTotalPayloadBytes()));
}
double packetsDuration = packetInfos.get(packetInfos.size() - 1).getTimeStamp() - packetInfos.get(0).getTimeStamp();
double tcpPacketDuration = (maxTCPPacketTimestamp > minTCPPacketTimestamp) ? (maxTCPPacketTimestamp - minTCPPacketTimestamp) : 0.0d;
double avgKbps = packetsDuration != 0 ? totalBytes * 8.0 / 1000.0 / packetsDuration : 0.0d;
double avgTCPKbps = tcpPacketDuration != 0 ? totalTCPBytes * 8.0 / 1000.0 / tcpPacketDuration : 0.0d;
stat.setApplicationPacketSummary(applicationPacketSummary);
stat.setAverageKbps(avgKbps);
stat.setAverageTCPKbps(avgTCPKbps);
stat.setIpPacketSummary(ipPacketSummary);
stat.setPacketDuration(packetsDuration);
stat.setTcpPacketDuration(tcpPacketDuration);
stat.setTotalByte(totalBytes);
stat.setTotalPayloadBytes(totalPayloadBytes);
stat.setTotalTCPBytes(totalTCPBytes);
stat.setTotalTCPPayloadBytes(totalTCPPayloadBytes);
stat.setTotalHTTPSByte(totalHTTPSBytes);
stat.setTotalPackets(packetInfos.size());
stat.setTotalTCPPackets(totalTCPPackets);
stat.setPacketSizeToCountMap(packetSizeToCountMap);
}
stat.setAppName(appNames);
return stat;
}
Aggregations