- public static BGPError forValue(final int e, final int s) {
- if (e == 1) {
- if (s == 1) {
- return BGPError.CONNECTION_NOT_SYNC;
- }
- if (s == 2) {
- return BGPError.BAD_MSG_LENGTH;
- }
- if (s == 3) {
- return BGPError.BAD_MSG_TYPE;
- }
- } else if (e == 2) {
- if (s == 0) {
- return BGPError.UNSPECIFIC_OPEN_ERROR;
- }
- if (s == 1) {
- return BGPError.VERSION_NOT_SUPPORTED;
- }
- if (s == 2) {
- return BGPError.BAD_PEER_AS;
- }
- if (s == 3) {
- return BGPError.BAD_BGP_ID;
- }
- if (s == 4) {
- return BGPError.OPT_PARAM_NOT_SUPPORTED;
- }
- if (s == 6) {
- return BGPError.HOLD_TIME_NOT_ACC;
- }
- } else if (e == 3) {
- if (s == 1) {
- return BGPError.MALFORMED_ATTR_LIST;
- }
- if (s == 2) {
- return BGPError.WELL_KNOWN_ATTR_NOT_RECOGNIZED;
- }
- if (s == 3) {
- return BGPError.WELL_KNOWN_ATTR_MISSING;
- }
- if (s == 4) {
- return BGPError.ATTR_FLAGS_MISSING;
- }
- if (s == 5) {
- return BGPError.ATTR_LENGTH_ERROR;
- }
- if (s == 6) {
- return BGPError.ORIGIN_ATTR_NOT_VALID;
+ private BGPErrorIdentifier getErrorIdentifier() {
+ return this.errorId;
+ }
+
+ /**
+ * Caret for combination of Error-type and Error-value
+ */
+ private static final class BGPErrorIdentifier {
+ private final short code;
+ private final short subcode;
+
+ BGPErrorIdentifier(final short code, final short subcode) {
+ this.code = code;
+ this.subcode = subcode;
+ }
+
+ public short getCode() {
+ return this.code;
+ }
+
+ public short getSubCode() {
+ return this.subcode;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + this.code;
+ result = prime * result + this.subcode;
+ return result;
+ }
+
+ @Override
+ public boolean equals(final java.lang.Object obj) {
+ if (this == obj) {
+ return true;