Commit | Line | Data |
---|---|---|
b04903a2 | 1 | /******************************************************************************* |
ed902a2b | 2 | * Copyright (c) 2014, 2015 Ericsson |
b04903a2 AM |
3 | * |
4 | * All rights reserved. This program and the accompanying materials are | |
5 | * made available under the terms of the Eclipse Public License v1.0 which | |
6 | * accompanies this distribution, and is available at | |
7 | * http://www.eclipse.org/legal/epl-v10.html | |
8 | * | |
9 | * Contributors: | |
10 | * Vincent Perot - Initial API and implementation | |
11 | * Alexandre Montplaisir - Update to new ITmfEventAspect API | |
12 | *******************************************************************************/ | |
13 | ||
14 | package org.eclipse.tracecompass.internal.tmf.pcap.core.event.aspect; | |
15 | ||
2a28075c | 16 | import org.eclipse.jdt.annotation.Nullable; |
b04903a2 AM |
17 | import org.eclipse.tracecompass.internal.tmf.pcap.core.event.PcapEvent; |
18 | import org.eclipse.tracecompass.internal.tmf.pcap.core.protocol.TmfPcapProtocol; | |
19 | import org.eclipse.tracecompass.tmf.core.event.ITmfEvent; | |
20 | import org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect; | |
21 | ||
22 | /** | |
23 | * The "packet destination" aspect for pcap events. | |
24 | * | |
25 | * @author Alexandre Montplaisir | |
26 | */ | |
27 | public class PcapDestinationAspect implements ITmfEventAspect { | |
28 | ||
29 | @Override | |
30 | public String getName() { | |
31 | return Messages.getMessage(Messages.PcapAspectName_Destination); | |
32 | } | |
33 | ||
34 | @Override | |
35 | public String getHelpText() { | |
36 | return EMPTY_STRING; | |
37 | } | |
38 | ||
39 | @Override | |
2a28075c | 40 | public @Nullable String resolve(ITmfEvent event) { |
b04903a2 | 41 | if (!(event instanceof PcapEvent)) { |
2a28075c | 42 | return null; |
b04903a2 AM |
43 | } |
44 | PcapEvent pcapEvent = (PcapEvent) event; | |
45 | TmfPcapProtocol protocol = pcapEvent.getMostEncapsulatedProtocol(); | |
46 | ||
2a28075c | 47 | return pcapEvent.getDestinationEndpoint(protocol); |
b04903a2 | 48 | } |
b04903a2 | 49 | } |