Commit | Line | Data |
---|---|---|
b6eb4dce | 1 | /******************************************************************************* |
2c7fb5af | 2 | * Copyright (c) 2014, 2015 Ericsson |
b6eb4dce VP |
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 | *******************************************************************************/ | |
12 | ||
2bdf0193 | 13 | package org.eclipse.tracecompass.internal.tmf.pcap.core.protocol; |
b6eb4dce | 14 | |
71f2817f | 15 | import org.eclipse.tracecompass.internal.pcap.core.protocol.PcapProtocol; |
b6eb4dce VP |
16 | |
17 | /** | |
18 | * Enumeration as a TMF wrapper of the different Protocols. To register a | |
2c7fb5af PT |
19 | * protocol in TMF, it must be present in {@link PcapProtocol} and must have the |
20 | * same name. | |
b6eb4dce VP |
21 | * |
22 | * @author Vincent Perot | |
23 | */ | |
c88feda9 | 24 | public enum TmfPcapProtocol { |
b6eb4dce VP |
25 | |
26 | // Layer 0 | |
27 | /** | |
28 | * The Pcap Protocol is not a real protocol but is used as an helper to | |
29 | * generate Pcap packets. | |
30 | */ | |
e20e3d49 | 31 | PCAP(PcapProtocol.PCAP), |
b6eb4dce VP |
32 | |
33 | // Layer 1 | |
34 | // Should always be empty. | |
35 | ||
36 | // Layer 2 | |
37 | /** | |
38 | * The description of the Ethernet II Protocol. | |
39 | */ | |
e20e3d49 | 40 | ETHERNET_II(PcapProtocol.ETHERNET_II), |
b6eb4dce VP |
41 | |
42 | // Layer 3 | |
43 | /** | |
44 | * The description of the Internet Protocol Version 4. | |
45 | */ | |
e20e3d49 | 46 | IPV4(PcapProtocol.IPV4), |
b6eb4dce VP |
47 | |
48 | // Layer 4 | |
49 | /** | |
50 | * The description of the Transmission Control Protocol. | |
51 | */ | |
e20e3d49 | 52 | TCP(PcapProtocol.TCP), |
b6eb4dce VP |
53 | /** |
54 | * The description of the User Datagram Protocol. | |
55 | */ | |
e20e3d49 | 56 | UDP(PcapProtocol.UDP), |
b6eb4dce VP |
57 | |
58 | // Layer 5 | |
59 | ||
60 | // Layer 6 | |
61 | ||
62 | // Layer 7 | |
63 | /** | |
64 | * This protocol is used as an helper if the protocol of a packet is not | |
65 | * recognized. Since all its data goes into payload, it can also be seen as | |
66 | * a "payload packet". This is considered to be on layer 7 since its always | |
67 | * the most encapsulated packet if present. | |
68 | */ | |
e20e3d49 | 69 | UNKNOWN(PcapProtocol.UNKNOWN); |
b6eb4dce VP |
70 | |
71 | private final String fName; | |
72 | private final String fShortName; | |
b6eb4dce VP |
73 | private final boolean fSupportsStream; |
74 | ||
e20e3d49 AM |
75 | private TmfPcapProtocol(PcapProtocol pcapProto) { |
76 | fName = pcapProto.getName(); | |
77 | fShortName = pcapProto.getShortName(); | |
78 | fSupportsStream = pcapProto.supportsStream(); | |
b6eb4dce VP |
79 | } |
80 | ||
81 | /** | |
82 | * Getter method for the long name of the protocol. | |
83 | * | |
84 | * @return The long name of the protocol, as a string. | |
85 | */ | |
86 | public String getName() { | |
87 | return fName; | |
88 | } | |
89 | ||
90 | /** | |
91 | * Getter method for the short name of the protocol. | |
92 | * | |
93 | * @return The short name of the protocol, as a string. | |
94 | */ | |
95 | public String getShortName() { | |
96 | return fShortName; | |
97 | } | |
98 | ||
b6eb4dce VP |
99 | /** |
100 | * Getter method that indicates if the protocol supports streams. | |
101 | * | |
102 | * @return Whether the protocol supports streams or not. | |
103 | */ | |
104 | public boolean supportsStream() { | |
105 | return fSupportsStream; | |
106 | } | |
107 | ||
b6eb4dce | 108 | } |