blob: 980646f48078f3e9adf8258c04bfc818a9b8fa46 [file] [log] [blame]
pingping-lina2cbfad2013-03-07 08:39:21 +08001package net.floodlightcontroller.bgproute;
2
3import java.net.InetAddress;
4import java.net.UnknownHostException;
5
6public class Prefix {
7 public int masklen;
8 protected InetAddress address;
9
Jonathan Hart61ba9372013-05-19 20:10:29 -070010 public Prefix(byte[] addr, int masklen) throws UnknownHostException {
11 //try {
12 address = InetAddress.getByAddress(addr);
13 //} catch (UnknownHostException e) {
14 // System.out.println("InetAddress exception");
15 // return;
16 //}
pingping-lina2cbfad2013-03-07 08:39:21 +080017 this.masklen = masklen;
Jonathan Hart61ba9372013-05-19 20:10:29 -070018 //System.out.println(address.toString() + "/" + masklen);
pingping-lina2cbfad2013-03-07 08:39:21 +080019 }
Jonathan Hart61ba9372013-05-19 20:10:29 -070020
21 public Prefix(String str, int masklen) throws UnknownHostException {
22 //try {
23 address = InetAddress.getByName(str);
24 //} catch (UnknownHostException e) {
25 // System.out.println("InetAddress exception");
26 // return;
27 //}
pingping-lina2cbfad2013-03-07 08:39:21 +080028 this.masklen = masklen;
29 }
Jonathan Hart61ba9372013-05-19 20:10:29 -070030
pingping-lina2cbfad2013-03-07 08:39:21 +080031 public byte [] getAddress() {
32 return address.getAddress();
33 }
34}