blob: 19272e51fa152656041841bf310f6a0151a5d026 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
package com.lumaserv.bgp.protocol.message;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
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;
}
}
|