summaryrefslogtreecommitdiff
path: root/src/main/java/com/lumaserv/bgp/BGPSession.java
diff options
context:
space:
mode:
authorMikael Magnusson <mikma@users.sourceforge.net>2023-03-05 22:47:36 +0100
committerMikael Magnusson <mikma@users.sourceforge.net>2023-11-11 23:59:29 +0100
commit028ff0be508bf65cd7f811e645384c34ae8983b4 (patch)
tree0e2ce7dd59986f3c0226306dc6728bd704208c18 /src/main/java/com/lumaserv/bgp/BGPSession.java
parentb1eb0b03971dd0dfd0aac57af549ca2fe5138537 (diff)
Uncommitted changes
Diffstat (limited to 'src/main/java/com/lumaserv/bgp/BGPSession.java')
-rw-r--r--src/main/java/com/lumaserv/bgp/BGPSession.java10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/main/java/com/lumaserv/bgp/BGPSession.java b/src/main/java/com/lumaserv/bgp/BGPSession.java
index e785e3b..9de32ab 100644
--- a/src/main/java/com/lumaserv/bgp/BGPSession.java
+++ b/src/main/java/com/lumaserv/bgp/BGPSession.java
@@ -144,7 +144,7 @@ public class BGPSession implements Runnable {
System.out.println("Sent open");
}
- public void sendOpen() throws IOException {
+ void sendOpen() throws IOException {
BGPOpen.Capabilities caps = new BGPOpen.Capabilities();
caps.getCapabilities().add(new BGPOpen.MultiprotocolExtensionCapability(AFI.IPV4.getValue(), SAFI.UNICAST.getValue()));
caps.getCapabilities().add(new BGPOpen.MultiprotocolExtensionCapability(AFI.IPV6.getValue(), SAFI.UNICAST.getValue()));
@@ -161,6 +161,14 @@ System.out.println("Sent open");
sendOpen(request);
}
+ public void sendUpdate(BGPUpdate request) throws IOException {
+ if (fsm.getCurrentState() != fsm.ESTABLISHED) {
+ throw new RuntimeException("Can't send UPDATE in state " + fsm.getCurrentState());
+ }
+ outputStream.write(new BGPPacket().setType(BGPPacket.Type.UPDATE).setMessage(request.build()).build());
+ fsm.setKeepAliveTimer();
+ }
+
public void retryConnection() {
if (!socket.isConnected()) {
try {