blob: 5af82ac874593b356f820d3a21b44f1a40191ddd [file] [log] [blame]
Jian Li6b77dc02016-07-14 16:04:25 +09001/*
2 * Copyright 2016-present Open Networking Laboratory
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.onosproject.lisp.msg.types;
17
18import org.onlab.packet.IpAddress;
19
20/**
21 * IP address that is used by LISP Locator.
22 */
23public abstract class LispIpAddress extends LispAfiAddress {
24
25 protected final IpAddress address;
26
27 /**
28 * Initializes LISP locator's IP address with AFI enum.
29 *
30 * @param address IP address
31 * @param afi AFI enum
32 */
33 protected LispIpAddress(IpAddress address, AddressFamilyIdentifierEnum afi) {
34 super(afi);
35 this.address = address;
36 }
37
38 /**
39 * Obtains LISP locator's IP address.
40 *
41 * @return IP address
42 */
43 public IpAddress getAddress() {
44 return address;
45 }
46
47 @Override
48 public int hashCode() {
49 return address.hashCode();
50 }
51
52 @Override
53 public boolean equals(Object obj) {
54 return address.equals(obj);
55 }
56
57 @Override
58 public String toString() {
59 return address.toString();
60 }
61}