tmf: Use TmfFilterMatchesAspectNode's in the event table
[deliverable/tracecompass.git] / org.eclipse.tracecompass.tmf.pcap.core / src / org / eclipse / tracecompass / internal / tmf / pcap / core / event / aspect / PcapSourceAspect.java
1 /*******************************************************************************
2 * Copyright (c) 2014 Ericsson
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
16 import org.eclipse.tracecompass.internal.tmf.pcap.core.event.PcapEvent;
17 import org.eclipse.tracecompass.internal.tmf.pcap.core.protocol.TmfPcapProtocol;
18 import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
19 import org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect;
20
21 /**
22 * The packet source aspect for pcap events.
23 *
24 * This normally represents the source address of the packet, and the format
25 * depends on the protocol (e.g. source IP address, source port, etc.)
26 *
27 * @author Alexandre Montplaisir
28 */
29 public class PcapSourceAspect implements ITmfEventAspect {
30
31 @Override
32 public String getName() {
33 return Messages.getMessage(Messages.PcapAspectName_Source);
34 }
35
36 @Override
37 public String getHelpText() {
38 return EMPTY_STRING;
39 }
40
41 @Override
42 public String resolve(ITmfEvent event) {
43 if (!(event instanceof PcapEvent)) {
44 return EMPTY_STRING;
45 }
46 PcapEvent pcapEvent = (PcapEvent) event;
47 TmfPcapProtocol protocol = pcapEvent.getMostEncapsulatedProtocol();
48
49 String ret = pcapEvent.getSourceEndpoint(protocol);
50 return (ret == null ? EMPTY_STRING : ret);
51 }
52 }
This page took 0.051068 seconds and 5 git commands to generate.