summaryrefslogtreecommitdiff
path: root/src/main/java/com/lumaserv/bgp/protocol/AFI.java
diff options
context:
space:
mode:
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));
+ }
+}