summaryrefslogtreecommitdiff
path: root/src/main/java/com/lumaserv/bgp/protocol/AFI.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/AFI.java
parent45143e7d7ad17e149d4df8f5502a15c3222691e4 (diff)
WIP multiprotocol capability and IPv6
Diffstat (limited to 'src/main/java/com/lumaserv/bgp/protocol/AFI.java')
-rw-r--r--src/main/java/com/lumaserv/bgp/protocol/AFI.java21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/main/java/com/lumaserv/bgp/protocol/AFI.java b/src/main/java/com/lumaserv/bgp/protocol/AFI.java
new file mode 100644
index 0000000..1dce43b
--- /dev/null
+++ b/src/main/java/com/lumaserv/bgp/protocol/AFI.java
@@ -0,0 +1,21 @@
+package com.lumaserv.bgp.protocol;
+
+import java.util.EnumSet;
+
+import lombok.Getter;
+import lombok.AllArgsConstructor;
+
+@AllArgsConstructor
+@Getter
+public enum AFI {
+ IPV4(1, "IPv4"),
+ IPV6(2, "IPv6");
+
+ int value;
+ String desc;
+
+ public static AFI fromInteger(int value) {
+ return EnumSet.allOf(AFI.class).stream().filter(e -> e.getValue() == value).findAny().orElseThrow(
+ () -> new IllegalArgumentException("unknown address family: " + value));
+ }
+}