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