Search in sources :

Example 1 with PcapEvent

use of org.eclipse.tracecompass.internal.tmf.pcap.core.event.PcapEvent in project tracecompass by tracecompass.

the class PcapDestinationAspect method resolve.

@Override
@Nullable
public String resolve(ITmfEvent event) {
    if (!(event instanceof PcapEvent)) {
        return null;
    }
    PcapEvent pcapEvent = (PcapEvent) event;
    TmfPcapProtocol protocol = pcapEvent.getMostEncapsulatedProtocol();
    return pcapEvent.getDestinationEndpoint(protocol);
}
Also used : TmfPcapProtocol(org.eclipse.tracecompass.internal.tmf.pcap.core.protocol.TmfPcapProtocol) PcapEvent(org.eclipse.tracecompass.internal.tmf.pcap.core.event.PcapEvent) Nullable(org.eclipse.jdt.annotation.Nullable)

Example 2 with PcapEvent

use of org.eclipse.tracecompass.internal.tmf.pcap.core.event.PcapEvent in project tracecompass by tracecompass.

the class PcapProtocolAspect method resolve.

@Override
@Nullable
public String resolve(ITmfEvent event) {
    if (!(event instanceof PcapEvent)) {
        return null;
    }
    PcapEvent pcapEvent = (PcapEvent) event;
    TmfPcapProtocol protocol = pcapEvent.getMostEncapsulatedProtocol();
    return protocol.getShortName().toUpperCase();
}
Also used : TmfPcapProtocol(org.eclipse.tracecompass.internal.tmf.pcap.core.protocol.TmfPcapProtocol) PcapEvent(org.eclipse.tracecompass.internal.tmf.pcap.core.event.PcapEvent) Nullable(org.eclipse.jdt.annotation.Nullable)

Example 3 with PcapEvent

use of org.eclipse.tracecompass.internal.tmf.pcap.core.event.PcapEvent in project tracecompass by tracecompass.

the class PcapSourceAspect method resolve.

@Override
@Nullable
public String resolve(ITmfEvent event) {
    if (!(event instanceof PcapEvent)) {
        return null;
    }
    PcapEvent pcapEvent = (PcapEvent) event;
    TmfPcapProtocol protocol = pcapEvent.getMostEncapsulatedProtocol();
    return pcapEvent.getSourceEndpoint(protocol);
}
Also used : TmfPcapProtocol(org.eclipse.tracecompass.internal.tmf.pcap.core.protocol.TmfPcapProtocol) PcapEvent(org.eclipse.tracecompass.internal.tmf.pcap.core.event.PcapEvent) Nullable(org.eclipse.jdt.annotation.Nullable)

Example 4 with PcapEvent

use of org.eclipse.tracecompass.internal.tmf.pcap.core.event.PcapEvent in project tracecompass by tracecompass.

the class StreamListAnalysis method executeAnalysis.

@Override
protected boolean executeAnalysis(@Nullable IProgressMonitor monitor) throws TmfAnalysisException {
    IProgressMonitor mon = (monitor == null ? new NullProgressMonitor() : monitor);
    ITmfTrace trace = getTrace();
    if (trace == null) {
        /* This analysis was cancelled in the meantime */
        return false;
    }
    ITmfEventRequest request = fRequest;
    if ((request != null) && (!request.isCompleted())) {
        request.cancel();
    }
    request = new TmfEventRequest(PcapEvent.class, TmfTimeRange.ETERNITY, 0L, ITmfEventRequest.ALL_DATA, ITmfEventRequest.ExecutionType.BACKGROUND) {

        @Override
        public void handleData(ITmfEvent data) {
            // Called for each event
            super.handleData(data);
            if (!(data instanceof PcapEvent)) {
                return;
            }
            PcapEvent event = (PcapEvent) data;
            for (Map.Entry<TmfPcapProtocol, TmfPacketStreamBuilder> entry : fBuilders.entrySet()) {
                entry.getValue().addEventToStream(event);
            }
        }
    };
    trace.sendRequest(request);
    fRequest = request;
    try {
        request.waitForCompletion();
    } catch (InterruptedException e) {
        // Request was canceled.
        return false;
    }
    return !mon.isCanceled() && !request.isCancelled() && !request.isFailed();
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) ITmfEvent(org.eclipse.tracecompass.tmf.core.event.ITmfEvent) ITmfEventRequest(org.eclipse.tracecompass.tmf.core.request.ITmfEventRequest) TmfEventRequest(org.eclipse.tracecompass.tmf.core.request.TmfEventRequest) PcapEvent(org.eclipse.tracecompass.internal.tmf.pcap.core.event.PcapEvent) ITmfEventRequest(org.eclipse.tracecompass.tmf.core.request.ITmfEventRequest)

Example 5 with PcapEvent

use of org.eclipse.tracecompass.internal.tmf.pcap.core.event.PcapEvent in project tracecompass by tracecompass.

the class PcapTraceTest method testParseEvent.

/**
 * Test the parseEvent() method
 */
@Test
public void testParseEvent() {
    ITmfContext ctx = fFixture.seekEvent(0);
    fFixture.getNext(ctx);
    PcapEvent event = fFixture.parseEvent(ctx);
    assertNotNull(event);
}
Also used : ITmfContext(org.eclipse.tracecompass.tmf.core.trace.ITmfContext) PcapEvent(org.eclipse.tracecompass.internal.tmf.pcap.core.event.PcapEvent) Test(org.junit.Test)

Aggregations

PcapEvent (org.eclipse.tracecompass.internal.tmf.pcap.core.event.PcapEvent)6 Nullable (org.eclipse.jdt.annotation.Nullable)4 TmfPcapProtocol (org.eclipse.tracecompass.internal.tmf.pcap.core.protocol.TmfPcapProtocol)3 Path (java.nio.file.Path)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)1 NonNull (org.eclipse.jdt.annotation.NonNull)1 Packet (org.eclipse.tracecompass.internal.pcap.core.packet.Packet)1 PcapPacket (org.eclipse.tracecompass.internal.pcap.core.protocol.pcap.PcapPacket)1 PcapTimestampScale (org.eclipse.tracecompass.internal.pcap.core.util.PcapTimestampScale)1 PcapEventType (org.eclipse.tracecompass.internal.tmf.pcap.core.event.PcapEventType)1 PcapRootEventField (org.eclipse.tracecompass.internal.tmf.pcap.core.event.PcapRootEventField)1 ITmfEvent (org.eclipse.tracecompass.tmf.core.event.ITmfEvent)1 ITmfEventField (org.eclipse.tracecompass.tmf.core.event.ITmfEventField)1 TmfEventType (org.eclipse.tracecompass.tmf.core.event.TmfEventType)1 ITmfEventRequest (org.eclipse.tracecompass.tmf.core.request.ITmfEventRequest)1 TmfEventRequest (org.eclipse.tracecompass.tmf.core.request.TmfEventRequest)1 ITmfTimestamp (org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp)1 ITmfContext (org.eclipse.tracecompass.tmf.core.trace.ITmfContext)1 ITmfTrace (org.eclipse.tracecompass.tmf.core.trace.ITmfTrace)1