2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.protocol.concepts;
10 import org.opendaylight.protocol.concepts.Identifier;
13 * A network prefix object. Prefix is a networking concept grouping together
14 * a set of addresses into a 'subnet', such that their attributes can be easily
15 * expressed. A prefix is formed by a base NetworkAddress and number of leading
16 * bits which are considered significant. An address is considered to be a part
17 * of a prefix if it differes only in insignificant (right-most) bits.
19 * @param <T> template reference to a Network Address class
21 public interface Prefix<T extends NetworkAddress<?>> extends Identifier {
23 * Get the base address of the prefix.
25 * @return Base network address
27 public T getAddress();
30 * The the length of significant part of the base address.
32 * @return Prefix length
34 public int getLength();
37 * Check if a Prefix contains a particular network address.
39 * @param address Network address to check for membership
40 * @return true if address belongs to this subnet, false otherwise
42 public boolean contains(NetworkAddress<?> address);
45 * Returns the address family class.
47 * @return address family class
49 public AddressFamily<T> getAddressFamily();