forked from paaguti/java-mrt
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAdvertisement.java
More file actions
53 lines (44 loc) · 1.01 KB
/
Advertisement.java
File metadata and controls
53 lines (44 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// This file is part of java-mrt
// A library to parse MRT files
// This file is released under LGPL 3.0
// http://www.gnu.org/licenses/lgpl-3.0-standalone.html
package org.javamrt.mrt;
import java.net.InetAddress;
public class Advertisement extends Bgp4Update
{
public Advertisement(byte[] header, InetAddress peerIP, AS peerAS, Prefix prefix, Attributes updateAttr)
{
super(header, peerIP, peerAS, prefix, updateAttr);
this.updateType = 'A';
//
// this.updateStr = updateStr;
//
}
@Override
public boolean isIPv4()
{
return this.prefix.isIPv4();
}
@Override
public boolean isIPv6()
{
return this.prefix.isIPv6();
}
public String getCommunity()
{
Community comm = this.updateAttr.getCommunity();
return comm.toString();
}
public long getMed()
{
Med result = this.updateAttr.getMed();
return result.getMed();
}
/**
* overrides {@link Bgp4Update#toAdvertisement()}
*/
@Override
public Advertisement toAdvertisement() {
return this;
}
}