Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 1 | package net.floodlightcontroller.util; |
| 2 | |
| 3 | import net.floodlightcontroller.util.IPv6; |
| 4 | |
| 5 | /** |
| 6 | * The class representing an IPv6 network address. |
| 7 | */ |
| 8 | public class IPv6Net { |
| 9 | private IPv6 address; // The IPv6 address |
| 10 | private short prefixLen; // The prefix length |
| 11 | |
| 12 | /** |
| 13 | * Default constructor. |
| 14 | */ |
| 15 | public IPv6Net() { |
| 16 | this.prefixLen = 0; |
| 17 | } |
| 18 | |
| 19 | /** |
| 20 | * Constructor for a given address and prefix length. |
| 21 | * |
| 22 | * @param address the address to use. |
| 23 | * @param prefixLen the prefix length to use. |
| 24 | */ |
| 25 | public IPv6Net(IPv6 address, short prefixLen) { |
| 26 | this.address = address; |
| 27 | this.prefixLen = prefixLen; |
| 28 | } |
| 29 | |
| 30 | /** |
| 31 | * Get the address value of the IPv6Net address. |
| 32 | * |
| 33 | * @return the address value of the IPv6Net address. |
| 34 | */ |
| 35 | public IPv6 address() { return address; } |
| 36 | |
| 37 | /** |
| 38 | * Get the prefix length value of the IPv6Net address. |
| 39 | * |
| 40 | * @return the prefix length value of the IPv6Net address. |
| 41 | */ |
| 42 | public short prefixLen() { return prefixLen; } |
| 43 | |
| 44 | /** |
| 45 | * Set the value of the IPv6Net address. |
| 46 | * |
| 47 | * @param address the address to use. |
| 48 | * @param prefixLen the prefix length to use. |
| 49 | */ |
| 50 | public void setValue(IPv6 address, short prefixLen) { |
| 51 | this.address = address; |
| 52 | this.prefixLen = prefixLen; |
| 53 | } |
| 54 | |
| 55 | /** |
| 56 | * Convert the IPv6Net value to an "address/prefixLen" string. |
| 57 | * |
| 58 | * @return the IPv6Net value as an "address/prefixLen" string. |
| 59 | */ |
| 60 | @Override |
| 61 | public String toString() { |
| 62 | String ret = ""; |
| 63 | // TODO: Implement it! |
| 64 | return ret; |
| 65 | } |
| 66 | } |