diff options
Diffstat (limited to 'lttng/org.eclipse.linuxtools.pcap.core/src/org/eclipse/linuxtools/internal/pcap/core/protocol/tcp/TCPEndpoint.java')
-rw-r--r-- | lttng/org.eclipse.linuxtools.pcap.core/src/org/eclipse/linuxtools/internal/pcap/core/protocol/tcp/TCPEndpoint.java | 97 |
1 files changed, 0 insertions, 97 deletions
diff --git a/lttng/org.eclipse.linuxtools.pcap.core/src/org/eclipse/linuxtools/internal/pcap/core/protocol/tcp/TCPEndpoint.java b/lttng/org.eclipse.linuxtools.pcap.core/src/org/eclipse/linuxtools/internal/pcap/core/protocol/tcp/TCPEndpoint.java deleted file mode 100644 index 97b291cdf3..0000000000 --- a/lttng/org.eclipse.linuxtools.pcap.core/src/org/eclipse/linuxtools/internal/pcap/core/protocol/tcp/TCPEndpoint.java +++ /dev/null @@ -1,97 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 Ericsson - * - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Vincent Perot - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.linuxtools.internal.pcap.core.protocol.tcp; - -import org.eclipse.jdt.annotation.NonNull; -import org.eclipse.jdt.annotation.Nullable; -import org.eclipse.linuxtools.internal.pcap.core.endpoint.ProtocolEndpoint; - -/** - * Class that extends the {@link ProtocolEndpoint} class. It represents the - * endpoint at a TCP level. - * - * @author Vincent Perot - */ -public class TCPEndpoint extends ProtocolEndpoint { - - private final int fPort; - - /** - * Constructor of the {@link TCPEndpoint} class. It takes a packet to get - * its endpoint. Since every packet has two endpoints (source and - * destination), the isSourceEndpoint parameter is used to specify which - * endpoint to take. - * - * @param packet - * The packet that contains the endpoints. - * @param isSourceEndpoint - * Whether to take the source or the destination endpoint of the - * packet. - */ - public TCPEndpoint(TCPPacket packet, boolean isSourceEndpoint) { - super(packet, isSourceEndpoint); - fPort = isSourceEndpoint ? packet.getSourcePort() : packet.getDestinationPort(); - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - ProtocolEndpoint endpoint = getParentEndpoint(); - if (endpoint == null) { - result = 0; - } else { - result = endpoint.hashCode(); - } - result = prime * result + fPort; - return result; - } - - @Override - public boolean equals(@Nullable Object obj) { - if (this == obj) { - return true; - } - if (!(obj instanceof TCPEndpoint)) { - return false; - } - - TCPEndpoint other = (TCPEndpoint) obj; - - // Check on layer - boolean localEquals = (fPort == other.fPort); - if (!localEquals) { - return false; - } - - // Check above layers. - ProtocolEndpoint endpoint = getParentEndpoint(); - if (endpoint != null) { - return endpoint.equals(other.getParentEndpoint()); - } - return true; - } - - @Override - public String toString() { - ProtocolEndpoint endpoint = getParentEndpoint(); - if (endpoint == null) { - @SuppressWarnings("null") - @NonNull - String ret = String.valueOf(fPort); - return ret; - } - return endpoint.toString() + '/' + fPort; - } - -} |