blob: 574e820fe23a99a9df2f3f3f800a8e1d33405783 [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 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
pingping-line2a09ca2013-03-23 09:33:58 +080043 return this.routerId.equals(r.routerId) && this.nextHop.equals(r.nextHop) && this.masklen == r.masklen;
44
pingping-lina2cbfad2013-03-07 08:39:21 +080045 }
46}