Search in sources :

Example 6 with TmfPcapProtocol

use of org.eclipse.tracecompass.internal.tmf.pcap.core.protocol.TmfPcapProtocol 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 7 with TmfPcapProtocol

use of org.eclipse.tracecompass.internal.tmf.pcap.core.protocol.TmfPcapProtocol in project tracecompass by tracecompass.

the class PcapEvent method getFields.

/**
 * Method that returns an immutable map containing all the fields of a
 * packet at a certain protocol. For instance, to get the Source IP Address,
 * use:
 * <code>event.getFields(TmfProtocol.IPV4).get("Source IP Address");</code>. <br>
 * It returns null if the protocol is inexistent in the PcapEvent.
 *
 * @param protocol
 *            The specified protocol
 * @return A map containing the fields.
 */
@Nullable
public Map<String, String> getFields(TmfPcapProtocol protocol) {
    PcapProtocol p = ProtocolConversion.unwrap(protocol);
    Packet packet = fPacket.getPacket(p);
    if (packet == null) {
        return null;
    }
    return packet.getFields();
}
Also used : Packet(org.eclipse.tracecompass.internal.pcap.core.packet.Packet) PcapProtocol(org.eclipse.tracecompass.internal.pcap.core.protocol.PcapProtocol) TmfPcapProtocol(org.eclipse.tracecompass.internal.tmf.pcap.core.protocol.TmfPcapProtocol) Nullable(org.eclipse.jdt.annotation.Nullable)

Example 8 with TmfPcapProtocol

use of org.eclipse.tracecompass.internal.tmf.pcap.core.protocol.TmfPcapProtocol in project tracecompass by tracecompass.

the class PcapEvent method getSourceEndpoint.

/**
 * Method that returns the source endpoint at a certain protocol level. It
 * returns null if the protocol is inexistent in the PcapEvent.
 *
 * @param protocol
 *            The specified protocol
 * @return The source endpoint.
 */
@Nullable
public String getSourceEndpoint(TmfPcapProtocol protocol) {
    PcapProtocol p = ProtocolConversion.unwrap(protocol);
    Packet packet = fPacket.getPacket(p);
    if (packet == null) {
        return null;
    }
    return packet.getSourceEndpoint().toString();
}
Also used : Packet(org.eclipse.tracecompass.internal.pcap.core.packet.Packet) PcapProtocol(org.eclipse.tracecompass.internal.pcap.core.protocol.PcapProtocol) TmfPcapProtocol(org.eclipse.tracecompass.internal.tmf.pcap.core.protocol.TmfPcapProtocol) Nullable(org.eclipse.jdt.annotation.Nullable)

Example 9 with TmfPcapProtocol

use of org.eclipse.tracecompass.internal.tmf.pcap.core.protocol.TmfPcapProtocol in project tracecompass by tracecompass.

the class PcapEvent method toString.

/**
 * Return the signification of the PcapEvent at a specific protocol level.
 *
 * @param protocol
 *            The specified protocol.
 * @return The signification as a String.
 */
public String toString(TmfPcapProtocol protocol) {
    PcapProtocol p = ProtocolConversion.unwrap(protocol);
    Packet packet = fPacket.getPacket(p);
    if (packet == null) {
        return EMPTY_STRING;
    }
    return packet.getLocalSummaryString();
}
Also used : Packet(org.eclipse.tracecompass.internal.pcap.core.packet.Packet) PcapProtocol(org.eclipse.tracecompass.internal.pcap.core.protocol.PcapProtocol) TmfPcapProtocol(org.eclipse.tracecompass.internal.tmf.pcap.core.protocol.TmfPcapProtocol)

Example 10 with TmfPcapProtocol

use of org.eclipse.tracecompass.internal.tmf.pcap.core.protocol.TmfPcapProtocol in project tracecompass by tracecompass.

the class StreamListAnalysisTest method constructorTest.

/**
 * Method that tests the constructor.
 */
@Test
public void constructorTest() {
    StreamListAnalysis analysis = new StreamListAnalysis();
    analysis.setId(StreamListAnalysis.ID);
    for (TmfPcapProtocol protocol : TmfPcapProtocol.values()) {
        if (protocol.supportsStream()) {
            assertNotNull(analysis.getBuilder(protocol));
        }
    }
    assertFalse(analysis.isFinished());
    analysis.dispose();
}
Also used : TmfPcapProtocol(org.eclipse.tracecompass.internal.tmf.pcap.core.protocol.TmfPcapProtocol) StreamListAnalysis(org.eclipse.tracecompass.internal.tmf.pcap.core.analysis.StreamListAnalysis) Test(org.junit.Test)

Aggregations

TmfPcapProtocol (org.eclipse.tracecompass.internal.tmf.pcap.core.protocol.TmfPcapProtocol)14 Nullable (org.eclipse.jdt.annotation.Nullable)8 Packet (org.eclipse.tracecompass.internal.pcap.core.packet.Packet)6 PcapProtocol (org.eclipse.tracecompass.internal.pcap.core.protocol.PcapProtocol)5 Table (org.eclipse.swt.widgets.Table)3 PcapEvent (org.eclipse.tracecompass.internal.tmf.pcap.core.event.PcapEvent)3 Display (org.eclipse.swt.widgets.Display)2 StreamListAnalysis (org.eclipse.tracecompass.internal.tmf.pcap.core.analysis.StreamListAnalysis)2 TmfPacketStream (org.eclipse.tracecompass.internal.tmf.pcap.core.event.TmfPacketStream)2 ImmutableList (com.google.common.collect.ImmutableList)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 CTabFolder (org.eclipse.swt.custom.CTabFolder)1 CTabItem (org.eclipse.swt.custom.CTabItem)1 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 Event (org.eclipse.swt.widgets.Event)1 Listener (org.eclipse.swt.widgets.Listener)1 Menu (org.eclipse.swt.widgets.Menu)1