Search in sources :

Example 1 with TmfPcapProtocol

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

the class PcapEvent method getDestinationEndpoint.

/**
 * Method that returns the destination endpoint at a certain protocol level.
 * It returns null if the protocol is inexistent in the PcapEvent.
 *
 * @param protocol
 *            The specified protocol
 * @return The destination endpoint.
 */
@Nullable
public String getDestinationEndpoint(TmfPcapProtocol protocol) {
    PcapProtocol p = ProtocolConversion.unwrap(protocol);
    Packet packet = fPacket.getPacket(p);
    if (packet == null) {
        return null;
    }
    return packet.getDestinationEndpoint().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 2 with TmfPcapProtocol

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

the class PcapEvent method getPayload.

/**
 * Method that returns the payload at a certain protocol level. It returns
 * null if the protocol is inexistent in the PcapEvent.
 *
 * @param protocol
 *            The specified protocol
 * @return The payload as a ByteBuffer.
 */
@Nullable
public ByteBuffer getPayload(TmfPcapProtocol protocol) {
    PcapProtocol p = ProtocolConversion.unwrap(protocol);
    Packet packet = fPacket.getPacket(p);
    if (packet == null) {
        return null;
    }
    return packet.getPayload();
}
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 3 with TmfPcapProtocol

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

the class PcapEvent method getProtocols.

/**
 * Method that returns all the protocols in this PcapEvent.
 *
 * @return A list containing all the TmfProtocol.
 */
public Collection<TmfPcapProtocol> getProtocols() {
    if (fProtocols != null) {
        return fProtocols;
    }
    ImmutableList.Builder<TmfPcapProtocol> builder = new ImmutableList.Builder<>();
    Packet packet = fPacket;
    // Go to start.
    while (packet != null && packet.getParentPacket() != null) {
        packet = packet.getParentPacket();
    }
    if (packet == null) {
        fProtocols = Collections.emptyList();
        return fProtocols;
    }
    // Go through all the packets and add them to list.
    builder.add(ProtocolConversion.wrap(packet.getProtocol()));
    while (packet != null && packet.getChildPacket() != null) {
        packet = packet.getChildPacket();
        if (packet != null) {
            builder.add(ProtocolConversion.wrap(packet.getProtocol()));
        }
    }
    fProtocols = builder.build();
    return fProtocols;
}
Also used : Packet(org.eclipse.tracecompass.internal.pcap.core.packet.Packet) ImmutableList(com.google.common.collect.ImmutableList) TmfPcapProtocol(org.eclipse.tracecompass.internal.tmf.pcap.core.protocol.TmfPcapProtocol)

Example 4 with TmfPcapProtocol

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

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

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