pingping-lin | a2cbfad | 2013-03-07 08:39:21 +0800 | [diff] [blame] | 1 | package net.floodlightcontroller.bgproute; |
| 2 | |
| 3 | import java.net.InetAddress; |
| 4 | import java.net.UnknownHostException; |
| 5 | |
| 6 | public class Rib { |
| 7 | protected InetAddress routerId; |
| 8 | protected InetAddress nextHop; |
| 9 | protected int masklen; |
| 10 | // protected int distance; |
| 11 | |
| 12 | Rib(InetAddress router_id, InetAddress nexthop, int masklen) { |
| 13 | this.routerId = router_id; |
| 14 | this.nextHop = nexthop; |
| 15 | this.masklen = masklen; |
| 16 | // this.distance = distance; |
| 17 | } |
| 18 | |
| 19 | Rib(String router_id, String nexthop, int masklen) { |
| 20 | try { |
| 21 | this.routerId = InetAddress.getByName(router_id); |
| 22 | } catch (UnknownHostException e) { |
| 23 | System.out.println("InetAddress exception"); |
| 24 | } |
| 25 | try { |
| 26 | this.nextHop = InetAddress.getByName(nexthop); |
| 27 | } catch (UnknownHostException e) { |
| 28 | System.out.println("InetAddress exception"); |
| 29 | } |
| 30 | this.masklen = masklen; |
| 31 | } |
| 32 | |
| 33 | public InetAddress getNextHop() { |
| 34 | return nextHop; |
| 35 | } |
| 36 | |
| 37 | public int getMasklen(){ |
| 38 | return masklen; |
| 39 | } |
| 40 | |
| 41 | public boolean equals(Rib r) { |
| 42 | |
| 43 | return this.routerId == r.routerId && this.nextHop == r.nextHop && this.masklen == r.masklen; |
| 44 | } |
| 45 | } |