Search in sources :

Example 36 with PacketInfo

use of com.att.aro.core.packetanalysis.pojo.PacketInfo in project VideoOptimzer by attdevsupport.

the class SessionManagerImpl method analyzeRequestResponsesForQUICUDPSession.

/**
 * Estimate RequestResponseObjects for Secure Sessions
 * @param session
 * @return
 */
private ArrayList<HttpRequestResponseInfo> analyzeRequestResponsesForQUICUDPSession(Session session) {
    ArrayList<HttpRequestResponseInfo> results = new ArrayList<>();
    boolean flag = false;
    UDPPacket udpPacket = null;
    HttpRequestResponseInfo rrInfo = null;
    HttpRequestResponseInfo downlinkRRInfo = null;
    for (PacketInfo packetInfo : session.getAllPackets()) {
        udpPacket = (UDPPacket) packetInfo.getPacket();
        if (packetInfo.getDir() == PacketDirection.UPLINK) {
            if (udpPacket.getPacketLength() >= AVG_QUIC_UDP_PACKET_SIZE && !flag) {
                rrInfo = generateRequestResponseObjectsForSSLOrUDPSessions(session.getRemoteHostName(), packetInfo.getDir(), packetInfo, false);
                results.add(rrInfo);
                flag = true;
            }
            updateRequestResponseObject(rrInfo, packetInfo);
        }
        if (packetInfo.getDir() == PacketDirection.DOWNLINK) {
            if (flag) {
                downlinkRRInfo = generateRequestResponseObjectsForSSLOrUDPSessions(session.getRemoteHostName(), packetInfo.getDir(), packetInfo, false);
                results.add(downlinkRRInfo);
                flag = false;
            }
            updateRequestResponseObject(downlinkRRInfo, packetInfo);
        }
    }
    if (results.isEmpty() && !session.getUplinkPacketsSortedBySequenceNumbers().isEmpty() && !session.getDownlinkPacketsSortedBySequenceNumbers().isEmpty()) {
        PacketInfo packetInfo = identifyCorrectTransmissionStream(session.getUplinkPacketsSortedBySequenceNumbers().firstEntry().getValue(), session.getAckNumbers(), session, PacketDirection.UPLINK);
        rrInfo = generateRequestResponseObjectsForSSLOrUDPSessions(session.getRemoteHostName(), PacketDirection.UPLINK, packetInfo, false);
        packetInfo = identifyCorrectTransmissionStream(session.getUplinkPacketsSortedBySequenceNumbers().lastEntry().getValue(), session.getAckNumbers(), session, PacketDirection.UPLINK);
        rrInfo.setLastDataPacket(packetInfo);
        rrInfo.setExtractable(false);
        results.add(rrInfo);
        packetInfo = identifyCorrectTransmissionStream(session.getDownlinkPacketsSortedBySequenceNumbers().firstEntry().getValue(), session.getAckNumbers(), session, PacketDirection.DOWNLINK);
        downlinkRRInfo = generateRequestResponseObjectsForSSLOrUDPSessions(session.getRemoteHostName(), PacketDirection.DOWNLINK, packetInfo, false);
        packetInfo = identifyCorrectTransmissionStream(session.getDownlinkPacketsSortedBySequenceNumbers().lastEntry().getValue(), session.getAckNumbers(), session, PacketDirection.DOWNLINK);
        downlinkRRInfo.setLastDataPacket(packetInfo);
        downlinkRRInfo.setExtractable(false);
        results.add(downlinkRRInfo);
    }
    return results;
}
Also used : HttpRequestResponseInfo(com.att.aro.core.packetanalysis.pojo.HttpRequestResponseInfo) ArrayList(java.util.ArrayList) PacketInfo(com.att.aro.core.packetanalysis.pojo.PacketInfo) UDPPacket(com.att.aro.core.packetreader.pojo.UDPPacket)

Example 37 with PacketInfo

use of com.att.aro.core.packetanalysis.pojo.PacketInfo in project VideoOptimzer by attdevsupport.

the class TimeRangeAnalysis method performTimeRangeAnalysis.

/**
 * Performs a TimeRangeAnalysis on the trace data.
 * @param analysisData Packet analyzer result object
 */
private void performTimeRangeAnalysis(PacketAnalyzerResult analysisData) {
    if (analysisData != null) {
        List<RrcStateRange> rrcCollection = analysisData.getStatemachine().getStaterangelist();
        List<PacketInfo> packets = analysisData.getTraceresult().getAllpackets();
        if (controller != null) {
            PacketAnalyzerImpl packetAnalyzerImpl = (PacketAnalyzerImpl) (controller.getAROService().getAnalyzer());
            packets = packetAnalyzerImpl.filterPackets(analysisData.getFilter(), packets);
        }
        Profile profile = analysisData.getProfile();
        int packetNum = packets.size();
        for (int i = 0; i < packetNum; i++) {
            PacketInfo packetInfo = packets.get(i);
            if ((!ipv4Present || !ipv6Present) && packetInfo.getPacket() instanceof IPPacket) {
                IPPacket p = (IPPacket) packetInfo.getPacket();
                if (p.getIPVersion() == 4) {
                    ipv4Present = true;
                } else if (p.getIPVersion() == 6) {
                    ipv6Present = true;
                }
            }
            if (!tcpPresent && packetInfo.getPacket() instanceof TCPPacket) {
                tcpPresent = true;
            } else if ((!udpPresent || !dnsPresent) && packetInfo.getPacket() instanceof UDPPacket) {
                UDPPacket p = (UDPPacket) packetInfo.getPacket();
                udpPresent = true;
                if (p.isDNSPacket()) {
                    dnsPresent = true;
                }
            }
            if (packetInfo.getTimeStamp() >= startTime && packetInfo.getTimeStamp() <= endTime) {
                payloadLen += packetInfo.getPayloadLen();
                totalBytes += packetInfo.getLen();
                if (packetInfo.getDir().equals(PacketDirection.UPLINK)) {
                    uplinkBytes += packetInfo.getLen();
                } else if (packetInfo.getDir().equals(PacketDirection.DOWNLINK)) {
                    downlinkBytes += packetInfo.getLen();
                }
            }
        }
        int collectionSize = rrcCollection.size();
        for (int i = 0; i < collectionSize; i++) {
            double beginTime;
            double endTime;
            RrcStateRange rrc = rrcCollection.get(i);
            if (rrc.getEndTime() < this.startTime) {
                continue;
            }
            if (rrc.getBeginTime() > this.endTime) {
                continue;
            }
            if (rrc.getBeginTime() >= this.startTime) {
                beginTime = rrc.getBeginTime();
            } else {
                beginTime = this.startTime;
            }
            if (rrc.getEndTime() <= this.endTime) {
                endTime = rrc.getEndTime();
            } else {
                endTime = this.endTime;
            }
            RRCState rrcState = rrc.getState();
            rrcEnergy += updateEnergy(analysisData, profile, beginTime, endTime, rrcState);
            activeTime += updateActiveTime(profile, beginTime, endTime, rrcState);
        }
    }
}
Also used : RRCState(com.att.aro.core.packetanalysis.pojo.RRCState) TCPPacket(com.att.aro.core.packetreader.pojo.TCPPacket) RrcStateRange(com.att.aro.core.packetanalysis.pojo.RrcStateRange) PacketInfo(com.att.aro.core.packetanalysis.pojo.PacketInfo) UDPPacket(com.att.aro.core.packetreader.pojo.UDPPacket) Profile(com.att.aro.core.configuration.pojo.Profile) IPPacket(com.att.aro.core.packetreader.pojo.IPPacket)

Example 38 with PacketInfo

use of com.att.aro.core.packetanalysis.pojo.PacketInfo in project VideoOptimzer by attdevsupport.

the class RrcStateRangeFactoryImpl method createWiFi.

private List<RrcStateRange> createWiFi(List<PacketInfo> packetlist, ProfileWiFi profile, double traceDuration) {
    // Create results list
    ArrayList<RrcStateRange> result = new ArrayList<RrcStateRange>();
    // Iterate through packets in trace
    Iterator<PacketInfo> iter = packetlist.iterator();
    PacketInfo packet;
    if (iter.hasNext()) {
        // Track time of state changes
        double timer = 0.0;
        // Keep timestamp of previous packet in iteration
        packet = iter.next();
        packet.setStateMachine(RRCState.WIFI_ACTIVE);
        double last = packet.getTimeStamp();
        // Idle state till first packet is received
        result.add(new RrcStateRange(timer, last, RRCState.WIFI_IDLE));
        timer = last;
        while (iter.hasNext()) {
            packet = iter.next();
            packet.setStateMachine(RRCState.WIFI_ACTIVE);
            double curr = packet.getTimeStamp();
            // Check to see if we dropped to WiFi Active
            if (curr - last > profile.getWifiTailTime()) {
                timer = tailWiFi(result, timer, last, curr, profile);
                // If end of tail was reached, we need to the idle time before the next packet arrives
                if (timer < curr) {
                    result.add(new RrcStateRange(timer, curr, RRCState.WIFI_IDLE));
                    timer = curr;
                }
            }
            // Save current packet time as last packet for next iteration
            last = curr;
        }
        // Do final WiFi tail
        timer = tailWiFi(result, timer, last, traceDuration, profile);
        // Check for final idle time
        if (timer < traceDuration) {
            result.add(new RrcStateRange(timer, traceDuration, RRCState.WIFI_IDLE));
        }
    } else {
        // State is idle for the entire trace
        result.add(new RrcStateRange(0.0, traceDuration, RRCState.WIFI_IDLE));
    }
    return result;
}
Also used : ArrayList(java.util.ArrayList) RrcStateRange(com.att.aro.core.packetanalysis.pojo.RrcStateRange) PacketInfo(com.att.aro.core.packetanalysis.pojo.PacketInfo)

Example 39 with PacketInfo

use of com.att.aro.core.packetanalysis.pojo.PacketInfo in project VideoOptimzer by attdevsupport.

the class TraceDataReaderImpl method addToAllPackets.

private void addToAllPackets(String appName, Packet packet) {
    if (packet instanceof IPPacket) {
        IPPacket ipack = (IPPacket) packet;
        if ((ipack.getIPVersion() == 4) && (ipack.getFragmentOffset() != 0)) {
            LOGGER.warn("226 - no IP fragmentation");
        }
        addIpCount(ipack.getSourceIPAddress());
        addIpCount(ipack.getDestinationIPAddress());
    }
    allPackets.add(new PacketInfo(appName, packet));
}
Also used : PacketInfo(com.att.aro.core.packetanalysis.pojo.PacketInfo) IPPacket(com.att.aro.core.packetreader.pojo.IPPacket)

Example 40 with PacketInfo

use of com.att.aro.core.packetanalysis.pojo.PacketInfo in project VideoOptimzer by attdevsupport.

the class TraceDataReaderImpl method updatePacket.

private void updatePacket(Packet packet) {
    if (packet instanceof TCPPacket) {
        TCPPacket ipPacket = (TCPPacket) packet;
        for (PacketInfo info : allPackets) {
            Packet curPacket = (Packet) info.getPacket();
            if (curPacket instanceof TCPPacket) {
                TCPPacket tcpPacket = (TCPPacket) curPacket;
                if (ipPacket.getDestinationIPAddress().equals(tcpPacket.getDestinationIPAddress()) && ipPacket.getSourceIPAddress().equals(tcpPacket.getSourceIPAddress()) && ipPacket.getSequenceNumber() == tcpPacket.getSequenceNumber() && ipPacket.getAckNumber() == tcpPacket.getAckNumber() && packet.getData().length > 66) {
                    byte[] data = Arrays.copyOfRange(packet.getData(), 66, packet.getData().length);
                    tcpPacket.setDecrypted(true);
                    curPacket.setData(data);
                }
            }
        }
    }
}
Also used : TCPPacket(com.att.aro.core.packetreader.pojo.TCPPacket) Packet(com.att.aro.core.packetreader.pojo.Packet) IPPacket(com.att.aro.core.packetreader.pojo.IPPacket) UDPPacket(com.att.aro.core.packetreader.pojo.UDPPacket) TCPPacket(com.att.aro.core.packetreader.pojo.TCPPacket) PacketInfo(com.att.aro.core.packetanalysis.pojo.PacketInfo)

Aggregations

PacketInfo (com.att.aro.core.packetanalysis.pojo.PacketInfo)119 ArrayList (java.util.ArrayList)92 BaseTest (com.att.aro.core.BaseTest)63 Test (org.junit.Test)63 RrcStateRange (com.att.aro.core.packetanalysis.pojo.RrcStateRange)48 Session (com.att.aro.core.packetanalysis.pojo.Session)33 TCPPacket (com.att.aro.core.packetreader.pojo.TCPPacket)30 Profile3G (com.att.aro.core.configuration.pojo.Profile3G)26 Profile (com.att.aro.core.configuration.pojo.Profile)25 InetAddress (java.net.InetAddress)25 RRCState (com.att.aro.core.packetanalysis.pojo.RRCState)21 ProfileLTE (com.att.aro.core.configuration.pojo.ProfileLTE)18 HashSet (java.util.HashSet)16 HttpRequestResponseInfo (com.att.aro.core.packetanalysis.pojo.HttpRequestResponseInfo)14 UDPPacket (com.att.aro.core.packetreader.pojo.UDPPacket)14 Packet (com.att.aro.core.packetreader.pojo.Packet)11 HashMap (java.util.HashMap)11 BurstCollectionAnalysisData (com.att.aro.core.packetanalysis.pojo.BurstCollectionAnalysisData)9 DomainNameSystem (com.att.aro.core.packetreader.pojo.DomainNameSystem)9 IPPacket (com.att.aro.core.packetreader.pojo.IPPacket)9