/
TmfPcapProtocol.java
114 lines (97 loc) · 2.98 KB
/
TmfPcapProtocol.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/*******************************************************************************
* Copyright (c) 2014, 2023 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License 2.0 which
* accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Vincent Perot - Initial API and implementation
*******************************************************************************/
package org.eclipse.tracecompass.internal.tmf.pcap.core.protocol;
import org.eclipse.tracecompass.internal.pcap.core.protocol.PcapProtocol;
/**
* Enumeration as a TMF wrapper of the different Protocols. To register a
* protocol in TMF, it must be present in {@link PcapProtocol} and must have the
* same name.
*
* @author Vincent Perot
*/
public enum TmfPcapProtocol {
// Layer 0
/**
* The Pcap Protocol is not a real protocol but is used as an helper to
* generate Pcap packets.
*/
PCAP(PcapProtocol.PCAP),
// Layer 1
// Should always be empty.
// Layer 2
/**
* The description of the Ethernet II Protocol.
*/
ETHERNET_II(PcapProtocol.ETHERNET_II),
// Layer 3
/**
* The description of the Internet Protocol Version 4.
*/
IPV4(PcapProtocol.IPV4),
/**
* The description of the Internet Protocol Version 6.
*/
IPV6(PcapProtocol.IPV6),
// Layer 4
/**
* The description of the Transmission Control Protocol.
*/
TCP(PcapProtocol.TCP),
/**
* The description of the User Datagram Protocol.
*/
UDP(PcapProtocol.UDP),
// Layer 5
// Layer 6
// Layer 7
/**
* This protocol is used as an helper if the protocol of a packet is not
* recognized. Since all its data goes into payload, it can also be seen as
* a "payload packet". This is considered to be on layer 7 since its always
* the most encapsulated packet if present.
*/
UNKNOWN(PcapProtocol.UNKNOWN);
private final String fName;
private final String fShortName;
private final boolean fSupportsStream;
private TmfPcapProtocol(PcapProtocol pcapProto) {
fName = pcapProto.getName();
fShortName = pcapProto.getShortName();
fSupportsStream = pcapProto.supportsStream();
}
/**
* Getter method for the long name of the protocol.
*
* @return The long name of the protocol, as a string.
*/
public String getName() {
return fName;
}
/**
* Getter method for the short name of the protocol.
*
* @return The short name of the protocol, as a string.
*/
public String getShortName() {
return fShortName;
}
/**
* Getter method that indicates if the protocol supports streams.
*
* @return Whether the protocol supports streams or not.
*/
public boolean supportsStream() {
return fSupportsStream;
}
}