blob: 6c4c651893d0b9fbb25ffe7c3f962b15696a3e1a [file] [log] [blame]
package net.floodlightcontroller.util;
import net.floodlightcontroller.util.IPv4;
/**
* The class representing an IPv4 network address.
*/
public class IPv4Net {
private IPv4 address; // The IPv4 address
private short prefixLen; // The prefix length
/**
* Default constructor.
*/
public IPv4Net() {
this.prefixLen = 0;
}
/**
* Constructor for a given address and prefix length.
*
* @param address the address to use.
* @param prefixLen the prefix length to use.
*/
public IPv4Net(IPv4 address, short prefixLen) {
this.address = address;
this.prefixLen = prefixLen;
}
/**
* Get the address value of the IPv4Net address.
*
* @return the address value of the IPv4Net address.
*/
public IPv4 address() { return address; }
/**
* Get the prefix length value of the IPv4Net address.
*
* @return the prefix length value of the IPv4Net address.
*/
public short prefixLen() { return prefixLen; }
/**
* Set the value of the IPv4Net address.
*
* @param address the address to use.
* @param prefixLen the prefix length to use.
*/
public void setValue(IPv4 address, short prefixLen) {
this.address = address;
this.prefixLen = prefixLen;
}
/**
* Convert the IPv4Net value to an "address/prefixLen" string.
*
* @return the IPv4Net value as an "address/prefixLen" string.
*/
@Override
public String toString() {
String ret = "";
// TODO: Implement it!
return ret;
}
}