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