1 /*******************************************************************************
2 * Copyright (c) 2014 Ericsson
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
10 * Vincent Perot - Initial API and implementation
11 *******************************************************************************/
13 package org
.eclipse
.linuxtools
.internal
.tmf
.pcap
.core
.util
;
15 import org
.eclipse
.linuxtools
.internal
.pcap
.core
.protocol
.PcapProtocol
;
16 import org
.eclipse
.linuxtools
.internal
.tmf
.pcap
.core
.protocol
.TmfPcapProtocol
;
19 * Helper class that allows the conversion between Protocol and TmfProtocol.
20 * This is only used by this project and thus is internal (not API).
22 * @author Vincent Perot
24 public final class ProtocolConversion
{
26 private ProtocolConversion() {}
29 * Wrap a {@link PcapProtocol} into a {@link TmfPcapProtocol}.
32 * The {@link PcapProtocol} to match
33 * @return The TmfProtocol
35 public static TmfPcapProtocol
wrap(PcapProtocol protocol
) {
38 return TmfPcapProtocol
.ETHERNET_II
;
40 return TmfPcapProtocol
.IPV4
;
42 return TmfPcapProtocol
.PCAP
;
44 return TmfPcapProtocol
.TCP
;
46 return TmfPcapProtocol
.UDP
;
48 return TmfPcapProtocol
.UNKNOWN
;
50 throw new IllegalArgumentException();
55 * Unwrap a {@link TmfPcapProtocol} from a {@link PcapProtocol}.
59 * @return The Protocol
61 public static PcapProtocol
unwrap(TmfPcapProtocol protocol
) {
64 return PcapProtocol
.ETHERNET_II
;
66 return PcapProtocol
.IPV4
;
68 return PcapProtocol
.PCAP
;
70 return PcapProtocol
.TCP
;
72 return PcapProtocol
.UDP
;
74 return PcapProtocol
.UNKNOWN
;
76 throw new IllegalArgumentException();
This page took 0.033022 seconds and 5 git commands to generate.