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();
}
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();
}
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;
}
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);
}
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();
}
Aggregations