summaryrefslogtreecommitdiff
path: root/src/main/java/com/lumaserv/bgp/protocol/SAFI.java
diff options
context:
space:
mode:
authorMikael Magnusson <mikma@users.sourceforge.net>2022-01-30 14:49:42 +0100
committerMikael Magnusson <mikma@users.sourceforge.net>2023-11-13 00:17:57 +0100
commitd4eb9c36754afcfbfbf758afd80816ee71a57362 (patch)
tree5b5a0b658035bc9cef2f8058616f4f351370364f /src/main/java/com/lumaserv/bgp/protocol/SAFI.java
parent45143e7d7ad17e149d4df8f5502a15c3222691e4 (diff)
WIP multiprotocol capability and IPv6
Diffstat (limited to 'src/main/java/com/lumaserv/bgp/protocol/SAFI.java')
-rw-r--r--src/main/java/com/lumaserv/bgp/protocol/SAFI.java21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/main/java/com/lumaserv/bgp/protocol/SAFI.java b/src/main/java/com/lumaserv/bgp/protocol/SAFI.java
new file mode 100644
index 0000000..5fa6b99
--- /dev/null
+++ b/src/main/java/com/lumaserv/bgp/protocol/SAFI.java
@@ -0,0 +1,21 @@
+package com.lumaserv.bgp.protocol;
+
+import java.util.EnumSet;
+
+import lombok.Getter;
+import lombok.AllArgsConstructor;
+
+@AllArgsConstructor
+@Getter
+public enum SAFI {
+ UNICAST(1, "NLRI Unicast"),
+ MULTICAST(2, "NLRI Multicast");
+
+ int value;
+ String desc;
+
+ public static SAFI fromInteger(int value) {
+ return EnumSet.allOf(SAFI.class).stream().filter(e -> e.getValue() == value).findAny().orElseThrow(
+ () -> new IllegalArgumentException("unknown subsequent address family: " + value));
+ }
+}