Commit 968b308c authored by Bc. Matúš Husovský's avatar Bc. Matúš Husovský
Browse files

# Namiesto applicationID ukladane do DB applicationName

parent 3bc90f74
......@@ -19,10 +19,12 @@
package sk.tuke.cnl.bm.JXColl.accounting;
import java.io.UnsupportedEncodingException;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.charset.Charset;
import java.sql.Timestamp;
import java.util.Arrays;
import java.util.Calendar;
......@@ -60,6 +62,7 @@ public class AccountingManager {
private byte[] destinationMAC;
private byte[] applicationIdArray;
private byte[] tempIdArray;
private String applicationName;
private int applicationId;
private short protocolIdentifier;
private int sourcePort;
......@@ -95,7 +98,7 @@ public class AccountingManager {
* @param template sablona
* @param data Data
*/
public void processFlow(IPFIXTemplateRecord template, IPFIXDataRecord data){
public void processFlow(IPFIXTemplateRecord template, IPFIXDataRecord data) throws UnsupportedEncodingException{
byte[] portBytes;
int hashKey = 0;
......@@ -167,7 +170,8 @@ public class AccountingManager {
applicationIdArray[2] = tempIdArray[2];
applicationIdArray[3] = tempIdArray[1];
applicationId = byteArrayToInt(applicationIdArray);
elementID = 96;
applicationName = new String(data.getFieldValue(template.getFieldSpecifierPosition(elementID)), Charset.forName("UTF-8")).trim();
//hashKey = generateHashKey(sourceIPv4Address, destinationIPv4Address, protocolIdentifier, sourcePort, destinationPort, ipDiffServCodePoint, isMulticast);
//temporary
hashKey = generateHashKey(sourceIPv4AddressInet, destinationIPv4AddressInet,sourceMAC,destinationMAC, (short)0, sourcePort, destinationPort, (short)0, false, applicationId);
......@@ -218,7 +222,7 @@ public class AccountingManager {
log.debug("dst port"+destinationPort);
log.debug("octet delta count: " + octetDeltaCount);
log.debug("packet delta count: " + packetDeltaCount);
log.debug("application id: " + applicationId);
log.debug("application name: " + applicationName);
if(accRecordCache.containsKey(hashKey)){
//accRecordCache.aggregateFlow(hashKey, new Date(flowStartSeconds), octetTotalCount, packetTotalCount);
......@@ -235,7 +239,7 @@ public class AccountingManager {
// octetTotalCount, packetTotalCount);
accRecord = new AccountingRecord(sourceIPv4Address, destinationIPv4Address, sourceMAC, destinationMAC, protocolIdentifier,
sourcePort, destinationPort, ipDiffServCodePoint, firstFlowStartMilliseconds,lastFlowEndMiliseconds, isMulticast,
octetDeltaCount, packetDeltaCount, applicationId);
octetDeltaCount, packetDeltaCount, applicationId, applicationName);
accRecordCache.addAccountingRecord(hashKey, accRecord);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment