summaryrefslogtreecommitdiff
path: root/src/main/java/com/lumaserv/bgp/protocol/message/BGPNotification.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/lumaserv/bgp/protocol/message/BGPNotification.java')
-rw-r--r--src/main/java/com/lumaserv/bgp/protocol/message/BGPNotification.java38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/main/java/com/lumaserv/bgp/protocol/message/BGPNotification.java b/src/main/java/com/lumaserv/bgp/protocol/message/BGPNotification.java
index 54ee9bd..19272e5 100644
--- a/src/main/java/com/lumaserv/bgp/protocol/message/BGPNotification.java
+++ b/src/main/java/com/lumaserv/bgp/protocol/message/BGPNotification.java
@@ -1,5 +1,6 @@
package com.lumaserv.bgp.protocol.message;
+import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
@@ -10,9 +11,46 @@ public class BGPNotification {
byte majorErrorCode;
byte minorErrorCode;
+ /** Major error codes */
+ @Getter
+ public enum Error {
+ MESSAGE_HEADER_ERROR(1),
+ OPEN_MESSAGE_ERROR(2),
+ UPDATE_MESSAGE_ERROR(3),
+ HOLD_TIMER_ERROR(4),
+ FSM_ERROR(5),
+ CEASE(6);
+
+ byte code;
+
+ Error(int code) {
+ this.code = (byte)code;
+ }
+ }
+
+ /** Minor error codes for OPEN_MESSAGE_ERROR */
+ @Getter
+ public enum OpenMessageError {
+ UNSUPPORTED_VERSION_NUMBER(1),
+ BAD_PEER_AS(2),
+ BAD_BGP_IDENTIFIER(3),
+ UNSUPPORTED_OPTION_PARAMETER(4),
+ UNACCEPTABLE_HOLD_TIME(5);
+
+ byte code;
+
+ OpenMessageError(int code) {
+ this.code = (byte)code;
+ }
+ }
+
public BGPNotification(byte[] message) {
this.majorErrorCode = message[0];
this.minorErrorCode = message[1];
}
+ @Override
+ public String toString() {
+ return "" + majorErrorCode + ":" + minorErrorCode;
+ }
}