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
.pcap
.core
.protocol
.pcap
;
15 import org
.eclipse
.jdt
.annotation
.Nullable
;
16 import org
.eclipse
.linuxtools
.internal
.pcap
.core
.endpoint
.ProtocolEndpoint
;
19 * Class that extends the {@link ProtocolEndpoint} class. It represents the endpoint at
22 * @author Vincent Perot
24 public class PcapEndpoint
extends ProtocolEndpoint
{
27 * Constructor of the {@link PcapEndpoint} class. It takes a packet to get
28 * its endpoint. Since every packet has two endpoints (source and
29 * destination), the isSourceEndpoint parameter is used to specify which
33 * The packet that contains the endpoints.
34 * @param isSourceEndpoint
35 * Whether to take the source or the destination endpoint of the
38 public PcapEndpoint(PcapPacket packet
, boolean isSourceEndpoint
) {
39 super(packet
, isSourceEndpoint
);
43 public int hashCode() {
48 public String
toString() {
53 public boolean equals(@Nullable Object obj
) {
57 if (!(obj
instanceof PcapEndpoint
)) {
61 PcapEndpoint other
= (PcapEndpoint
) obj
;
63 // Check above layers.
64 ProtocolEndpoint endpoint
= getParentEndpoint();
65 if (endpoint
!= null) {
66 return endpoint
.equals(other
.getParentEndpoint());