Search in sources :

Example 1 with PcapProtocol

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

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

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

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

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

Aggregations

Packet (org.eclipse.tracecompass.internal.pcap.core.packet.Packet)5 PcapProtocol (org.eclipse.tracecompass.internal.pcap.core.protocol.PcapProtocol)5 TmfPcapProtocol (org.eclipse.tracecompass.internal.tmf.pcap.core.protocol.TmfPcapProtocol)5 Nullable (org.eclipse.jdt.annotation.Nullable)4